Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision d1408ca1

Von Niclas Zimmermann vor mehr als 11 Jahren hinzugefügt

  • ID d1408ca13458a782cbde2b768cdd7abdbdcb9348
  • Vorgänger 2d881637
  • Nachfolger 3af5e2e0

chart_link in acc_trans

Erstellt ein neues Pflichtfeld chart_link in der Tabelle acc_trans.
Wird bisher nur beschrieben und noch an keiner Stelle ausgelesen.

Conflicts:

SL/AP.pm
SL/AR.pm
SL/IR.pm
SL/IS.pm

Unterschiede anzeigen:

SL/AR.pm
172 172
        my $project_id = conv_i($form->{"project_id_$i"});
173 173

  
174 174
        # insert detail records in acc_trans
175
        $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id, taxkey, tax_id)
176
                     VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), ?, ?, ?, ?, ?)|;
175
        $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id, taxkey, tax_id, chart_link)
176
                     VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), ?, ?, ?, ?, ?, (SELECT c.link FROM chart c WHERE c.accno = ?))|;
177 177
        @values = (conv_i($form->{id}), $form->{AR_amounts}{"amount_$i"}, conv_i($form->{"amount_$i"}), conv_date($form->{transdate}), $project_id,
178
                   conv_i($form->{"taxkey_$i"}), conv_i($form->{"tax_id_$i"}));
178
                   conv_i($form->{"taxkey_$i"}), conv_i($form->{"tax_id_$i"}), $form->{AR_amounts}{"amount_$i"});
179 179
        do_query($form, $dbh, $query, @values);
180 180

  
181 181
        if ($form->{"tax_$i"} != 0) {
182 182
          # insert detail records in acc_trans
183
          $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id, taxkey, tax_id)
184
                       VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), ?, ?, ?, ?, ?)|;
183
          $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id, taxkey, tax_id, chart_link)
184
                       VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), ?, ?, ?, ?, ?, (SELECT c.link FROM chart c WHERE c.accno = ?))|;
185 185
          @values = (conv_i($form->{id}), $form->{AR_amounts}{"tax_$i"}, conv_i($form->{"tax_$i"}), conv_date($form->{transdate}), $project_id,
186
                     conv_i($form->{"taxkey_$i"}), conv_i($form->{"tax_id_$i"}));
186
                     conv_i($form->{"taxkey_$i"}), conv_i($form->{"tax_id_$i"}), $form->{AR_amounts}{"tax_$i"});
187 187
          do_query($form, $dbh, $query, @values);
188 188
        }
189 189
      }
190 190
    }
191 191

  
192 192
    # add recievables
193
    $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, tax_id)
193
    $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, tax_id, chart_link)
194 194
                 VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, (SELECT taxkey_id FROM chart WHERE accno = ?),
195 195
                 (SELECT tax_id 
196 196
                  FROM taxkeys 
......
198 198
                                   FROM chart 
199 199
                                   WHERE accno = ?) 
200 200
                  AND startdate <= ? 
201
                  ORDER BY startdate DESC LIMIT 1))|;
201
                  ORDER BY startdate DESC LIMIT 1),
202
                 (SELECT c.link FROM chart c WHERE c.accno = ?))|;
202 203
    @values = (conv_i($form->{id}), $form->{AR_amounts}{receivables}, conv_i($form->{receivables}), conv_date($form->{transdate}),
203
                $form->{AR_amounts}{receivables}, $form->{AR_amounts}{receivables}, conv_date($form->{transdate}));
204
                $form->{AR_amounts}{receivables}, $form->{AR_amounts}{receivables}, conv_date($form->{transdate}), $form->{AR_amounts}{receivables});
204 205
    do_query($form, $dbh, $query, @values);
205 206

  
206 207
  } else {
......
237 238

  
238 239
      if ($amount != 0) {
239 240
        # add receivable
240
        $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id, taxkey, tax_id)
241
        $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id, taxkey, tax_id, chart_link)
241 242
                     VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, (SELECT taxkey_id FROM chart WHERE accno = ?),
242 243
                     (SELECT tax_id 
243 244
                      FROM taxkeys 
......
245 246
                                       FROM chart 
246 247
                                       WHERE accno = ?) 
247 248
                      AND startdate <= ? 
248
                      ORDER BY startdate DESC LIMIT 1))|;
249
        @values = (conv_i($form->{id}), $form->{AR}{receivables}, $amount, conv_date($form->{"datepaid_$i"}), $project_id, $form->{AR}{receivables}, $form->{AR}{receivables}, conv_date($form->{"datepaid_$i"}));
249
                      ORDER BY startdate DESC LIMIT 1),
250
                     (SELECT c.link FROM chart c WHERE c.accno = ?))|;
251
        @values = (conv_i($form->{id}), $form->{AR}{receivables}, $amount, conv_date($form->{"datepaid_$i"}), $project_id, $form->{AR}{receivables}, $form->{AR}{receivables}, conv_date($form->{"datepaid_$i"}),
252
        $form->{AR}{receivables});
253

  
250 254
        do_query($form, $dbh, $query, @values);
251 255
      }
252 256

  
......
255 259
        my $project_id = conv_i($form->{"paid_project_id_$i"});
256 260
        my $gldate = (conv_date($form->{"gldate_$i"}))? conv_date($form->{"gldate_$i"}) : conv_date($form->current_date($myconfig));
257 261
        $amount = $form->{"paid_$i"} * -1;
258
        $query  = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, gldate, source, memo, project_id, taxkey, tax_id)
262
        $query  = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, gldate, source, memo, project_id, taxkey, tax_id, chart_link)
259 263
                     VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?, ?, ?, (SELECT taxkey_id FROM chart WHERE accno = ?),
260 264
                     (SELECT tax_id 
261 265
                      FROM taxkeys 
......
263 267
                                       FROM chart 
264 268
                                       WHERE accno = ?) 
265 269
                      AND startdate <= ? 
266
                      ORDER BY startdate DESC LIMIT 1))|;
270
                      ORDER BY startdate DESC LIMIT 1),
271
                     (SELECT c.link FROM chart c WHERE c.accno = ?))|;
267 272
        @values = (conv_i($form->{id}), $form->{AR}{"paid_$i"}, $amount, conv_date($form->{"datepaid_$i"}), $gldate, $form->{"source_$i"}, $form->{"memo_$i"}, $project_id, $form->{AR}{"paid_$i"},
268
                    $form->{AR}{"paid_$i"}, conv_date($form->{"datepaid_$i"}));
273
                    $form->{AR}{"paid_$i"}, conv_date($form->{"datepaid_$i"}), $form->{AR}{"paid_$i"});
269 274
        do_query($form, $dbh, $query, @values);
270 275

  
271 276
        # exchangerate difference for payment
272 277
        $amount = $form->round_amount( $form->{"paid_$i"} * ($form->{"exchangerate_$i"} - 1) * -1, 2);
273 278

  
274 279
        if ($amount != 0) {
275
          $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, fx_transaction, cleared, project_id, taxkey, tax_id)
280
          $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, fx_transaction, cleared, project_id, taxkey, tax_id, chart_link)
276 281
                       VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, 't', 'f', ?, (SELECT taxkey_id FROM chart WHERE accno = ?),
277 282
                       (SELECT tax_id 
278 283
                        FROM taxkeys 
......
280 285
                                         FROM chart 
281 286
                                         WHERE accno = ?) 
282 287
                        AND startdate <= ? 
283
                        ORDER BY startdate DESC LIMIT 1))|;
288
                        ORDER BY startdate DESC LIMIT 1),
289
                       (SELECT c.link FROM chart c WHERE c.accno = ?))|;
284 290
          @values = (conv_i($form->{id}), $form->{AR}{"paid_$i"}, $amount, conv_date($form->{"datepaid_$i"}), $project_id, $form->{AR}{"paid_$i"},
285
                    $form->{AR}{"paid_$i"}, conv_date($form->{"datepaid_$i"}));
291
                    $form->{AR}{"paid_$i"}, conv_date($form->{"datepaid_$i"}), $form->{AR}{"paid_$i"});
286 292
          do_query($form, $dbh, $query, @values);
287 293
        }
288 294

  
......
291 297

  
292 298
        if ($amount != 0) {
293 299
          my $accno = ($amount > 0) ? $form->{fxgain_accno} : $form->{fxloss_accno};
294
          $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, fx_transaction, cleared, project_id, taxkey, tax_id)
300
          $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, fx_transaction, cleared, project_id, taxkey, tax_id, chart_link)
295 301
                       VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, 't', 'f', ?, (SELECT taxkey_id FROM chart WHERE accno = ?),
296 302
                       (SELECT tax_id 
297 303
                        FROM taxkeys 
......
299 305
                                         FROM chart 
300 306
                                         WHERE accno = ?) 
301 307
                        AND startdate <= ? 
302
                        ORDER BY startdate DESC LIMIT 1))|;
303
          @values = (conv_i($form->{id}), $accno, $amount, conv_date($form->{"datepaid_$i"}), $project_id, $accno, $accno, conv_date($form->{"datepaid_$i"}));
308
                        ORDER BY startdate DESC LIMIT 1),
309
                       (SELECT c.link FROM chart c WHERE c.accno = ?))|;
310
          @values = (conv_i($form->{id}), $accno, $amount, conv_date($form->{"datepaid_$i"}), $project_id, $accno, $accno, conv_date($form->{"datepaid_$i"}), $accno);
304 311
          do_query($form, $dbh, $query, @values);
305 312
        }
306 313
      }

Auch abrufbar als: Unified diff