Пример #1
0
             break;
         case 3:
             $date = add_months($date_, $i * 1);
             break;
         case 4:
             $date = add_months($date_, $i * 3);
             break;
     }
     $am0 = $am;
 }
 if (isset($_POST['go'])) {
     $id = get_next_trans_no(ST_JOURNAL);
     $ref = $Refs->get_next(ST_JOURNAL);
     add_gl_trans(ST_JOURNAL, $id, $date, get_post('acc_act'), 0, 0, $ref, $am0 * -1);
     add_gl_trans(ST_JOURNAL, $id, $date, get_post('res_act'), get_post('dimension_id'), get_post('dimension2_id'), $ref, $am0);
     add_audit_trail(ST_JOURNAL, $id, $date);
     add_comments(ST_JOURNAL, $id, $date, $memo);
     $Refs->save(ST_JOURNAL, $id, $ref);
 } else {
     alt_table_row_color($k);
     label_cell($date);
     label_cell($_POST['acc_act'] . " " . get_gl_account_name($_POST['acc_act']));
     if ($dim > 0) {
         label_cell("");
     }
     if ($dim > 1) {
         label_cell("");
     }
     display_debit_or_credit_cells($am0 * -1);
     label_cell($memo);
     alt_table_row_color($k);
 // validation for
 if ($type == ST_BANKDEPOSIT || $type == ST_BANKPAYMENT) {
     $bankdesc = get_gl_account_name($bank_account_gl_code);
 }
 if ($type == ST_BANKDEPOSIT || $type == ST_BANKPAYMENT || $type == ST_JOURNAL) {
     $i = journal_display($i, $type, $taxtype, $amt, $entry, $code_id, $dim1, $dim2, $memo, $description, $bank_account_gl_code, $bank_desc);
 }
 if (!$error) {
     if ($type == ST_JOURNAL) {
         if (gl_account_in_bank_accounts($code_id) == true) {
             display_notification_centered(_("Error: Bank account detected in journal. No processing of bank accounts allowed. (line {$line} in import file '{$_FILES['imp']['name']}')"));
             $error = true;
         }
         if (check_tax_appropriate($code_id, $taxtype, $line) == true) {
             journal_inclusive_tax($type, $date, $line, $curEntryId, $code_id, $dim1, $dim2, $memo, $amt, $taxtype, $person_type_id, $person_id);
             add_audit_trail($type, $curEntryId, $date);
         }
     } elseif (($type == ST_BANKDEPOSIT || $type == ST_BANKPAYMENT) && $amt > 0) {
         if (check_tax_appropriate($code_id, $taxtype, $line) == true) {
             bank_inclusive_tax($type, $reference, $date, $bank_account, $bank_account_gl_code, $line, $curEntryId, $code_id, $dim1, $dim2, $memo, $amt, $taxtype, $person_type_id, $person_id, $BranchNo);
         } else {
             display_notification_centered(_("Warning: Taxtype used with Asset or Liability - {$curEntryId}, {$date}, {$code_id}.(line {$line} in import file '{$_FILES['imp']['name']}')"));
         }
     } elseif (($type == ST_BANKDEPOSIT || $type == ST_BANKPAYMENT) && $amt < 0) {
         display_notification_centered(_("Error: Credit amounts represented by negative amounts being entered. Check csv file is correct.(line {$line} in import file '{$_FILES['imp']['name']}')"));
         $error = true;
     }
     $entryCount = $entryCount + 1;
 }
 if ($error) {
     $errCnt = $errCnt + 1;