Ejemplo n.º 1
0
 */
if ($action == 'delbookkeeping') {
    $import_key = GETPOST('importkey', 'alpha');
    if (!empty($import_key)) {
        $object = new BookKeeping($db);
        $result = $object->delete_by_importkey($import_key);
        Header("Location: list.php");
        if ($result < 0) {
            setEventMessage($object->errors, 'errors');
        }
    }
} else {
    if ($action == 'export_csv') {
        header('Content-Type: text/csv');
        header('Content-Disposition: attachment;filename=export_csv.csv');
        $object = new BookKeeping($db);
        $result = $object->export_bookkeping('ebp');
        if ($result < 0) {
            setEventMessage($object->errors, 'errors');
        }
        foreach ($object->linesexport as $line) {
            print $line->id . ',';
            print '"' . dol_print_date($line->doc_date, '%d%m%Y') . '",';
            print '"' . $line->code_journal . '",';
            print '"' . $line->numero_compte . '",';
            print '"' . substr($line->code_journal, 0, 2) . '",';
            print '"' . substr($line->doc_ref, 0, 40) . '",';
            print '"' . $line->num_piece . '",';
            print '"' . $line->montant . '",';
            print '"' . $line->sens . '",';
            print '"' . dol_print_date($line->doc_date, '%d%m%Y') . '",';
Ejemplo n.º 2
0
    print '<tr>';
    print '<td>' . $langs->trans("Docref") . '</td>';
    print '<td><input type="text" size="20" name="doc_ref" value=""/></td>';
    print '</tr>';
    print '<tr>';
    print '<td>' . $langs->trans("Doctype") . '</td>';
    print '<td><input type="text" size="20" name="doc_type" value=""/></td>';
    print '</tr>';
    print '</table>';
    dol_fiche_end();
    print '<div align="center"><input type="submit" class="button" value="' . $langs->trans("Create") . '">';
    print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="' . $langs->trans("Cancel") . '" class="button" onclick="history.go(-1)" />';
    print '</div>';
    print '</form>';
} else {
    $book = new BookKeeping($db);
    $result = $book->fetchPerMvt($piece_num);
    if ($result < 0) {
        setEventMessages($book->error, $book->errors, 'errors');
    }
    if (!empty($book->piece_num)) {
        print load_fiche_titre($langs->trans("UpdateMvts"), '<a href="list.php">' . $langs->trans('BackToList') . '</a>');
        print '<table class="border" width="100%">';
        print '<tr class="pair">';
        print '<td width="25%">' . $langs->trans("NumMvts") . '</td>';
        print '<td>' . $book->piece_num . '</td>';
        print '</tr>';
        print '<tr class="impair">';
        print '<td>' . $langs->trans("Docdate") . '</td>';
        print '<td>' . dol_print_date($book->doc_date, 'daytextshort') . '</td>';
        print '</tr>';
Ejemplo n.º 3
0
             $resultmid = $db->query($sqlmid);
             if ($resultmid) {
                 $objmid = $db->fetch_object($resultmid);
                 $bookkeeping->doc_ref = $objmid->ref_supplier . ' (' . $objmid->ref . ')';
             }
         }
     }
     $result = $bookkeeping->create($user);
     if ($result < 0) {
         $error++;
         setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
     }
 }
 // Third party
 foreach ($tabtp[$key] as $k => $mt) {
     $bookkeeping = new BookKeeping($db);
     $bookkeeping->doc_date = $val["date"];
     $bookkeeping->doc_ref = $val["ref"];
     $bookkeeping->doc_type = 'bank';
     $bookkeeping->fk_doc = $key;
     $bookkeeping->fk_docdet = $val["fk_bank"];
     $bookkeeping->label_compte = $tabcompany[$key]['name'];
     $bookkeeping->montant = $mt < 0 ? -$mt : $mt;
     $bookkeeping->sens = $mt < 0 ? 'D' : 'C';
     $bookkeeping->debit = $mt < 0 ? -$mt : 0;
     $bookkeeping->credit = $mt >= 0 ? $mt : 0;
     $bookkeeping->code_journal = $journal;
     $bookkeeping->fk_user_author = $user->id;
     $bookkeeping->date_create = $now;
     if ($tabtype[$key] == 'sc') {
         $bookkeeping->code_tiers = '';
Ejemplo n.º 4
0
}
$search_accountancy_aux_code = GETPOST("search_accountancy_aux_code");
$search_accountancy_aux_code_start = GETPOST('search_accountancy_aux_code_start', 'alpha');
if ($search_accountancy_aux_code_start == -1) {
    $search_accountancy_aux_code_start = '';
}
$search_accountancy_aux_code_end = GETPOST('search_accountancy_aux_code_end', 'alpha');
if ($search_accountancy_aux_code_end == -1) {
    $search_accountancy_aux_code_end = '';
}
$search_mvt_label = GETPOST('search_mvt_label', 'alpha');
$search_direction = GETPOST('search_direction', 'alpha');
$search_ledger_code = GETPOST('search_ledger_code', 'alpha');
$limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
$offset = $limit * $page;
$object = new BookKeeping($db);
$formventilation = new FormVentilation($db);
$formother = new FormOther($db);
$form = new Form($db);
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) {
    $search_mvt_num = '';
    $search_doc_type = '';
    $search_doc_ref = '';
    $search_doc_date = '';
    $search_accountancy_code = '';
    $search_accountancy_code_start = '';
    $search_accountancy_code_end = '';
    $search_accountancy_aux_code = '';
    $search_accountancy_aux_code_start = '';
    $search_accountancy_aux_code_end = '';
    $search_mvt_label = '';
Ejemplo n.º 5
0
             $bookkeeping->credit = $mt >= 0 ? $mt : 0;
             $bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
             $bookkeeping->fk_user_author = $user->id;
             $result = $bookkeeping->create();
             if ($result < 0) {
                 $error++;
                 setEventMessages($object->error, $object->errors, 'errors');
             }
         }
     }
 }
 // VAT
 // var_dump($tabtva);
 foreach ($tabtva[$key] as $k => $mt) {
     if ($mt) {
         $bookkeeping = new BookKeeping($db);
         $bookkeeping->doc_date = $val["date"];
         $bookkeeping->doc_ref = $val["ref"];
         $bookkeeping->date_create = $now;
         $bookkeeping->doc_type = 'customer_invoice';
         $bookkeeping->fk_doc = $key;
         $bookkeeping->fk_docdet = $val["fk_facturedet"];
         $bookkeeping->code_tiers = '';
         $bookkeeping->numero_compte = $k;
         $bookkeeping->label_compte = $langs->trans("VAT");
         $bookkeeping->montant = $mt;
         $bookkeeping->sens = $mt < 0 ? 'D' : 'C';
         $bookkeeping->debit = $mt < 0 ? $mt : 0;
         $bookkeeping->credit = $mt >= 0 ? $mt : 0;
         $bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
         $bookkeeping->fk_user_author = $user->id;
Ejemplo n.º 6
0
             $bookkeeping->numero_compte = $k;
             $bookkeeping->montant = $mt;
             $bookkeeping->sens = $mt < 0 ? 'C' : 'D';
             $bookkeeping->debit = $mt > 0 ? $mt : 0;
             $bookkeeping->credit = $mt <= 0 ? $mt : 0;
             $bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
             $bookkeeping->create();
         }
     }
 }
 // VAT
 // var_dump($tabtva);
 foreach ($tabtva[$key] as $k => $mt) {
     if ($mt) {
         // get compte id and label
         $bookkeeping = new BookKeeping($db);
         $bookkeeping->doc_date = $val["date"];
         $bookkeeping->doc_ref = $val["ref"];
         $bookkeeping->date_create = $now;
         $bookkeeping->doc_type = 'supplier_invoice';
         $bookkeeping->fk_doc = $key;
         $bookkeeping->fk_docdet = $val["fk_facturefourndet"];
         $bookkeeping->code_tiers = '';
         $bookkeeping->label_compte = $langs->trans("VAT");
         $bookkeeping->numero_compte = $k;
         $bookkeeping->montant = $mt;
         $bookkeeping->sens = $mt < 0 ? 'C' : 'D';
         $bookkeeping->debit = $mt > 0 ? $mt : 0;
         $bookkeeping->credit = $mt <= 0 ? $mt : 0;
         $bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
         $bookkeeping->create();
Ejemplo n.º 7
0
if ($search_numero_compte_end == -1) {
    $search_numero_compte_end = '';
}
$search_code_tiers = GETPOST('search_code_tiers', 'alpha');
$search_code_tiers_start = GETPOST('search_code_tiers_start', 'alpha');
if ($search_code_tiers_start == -1) {
    $search_code_tiers_start = '';
}
$search_code_tiers_end = GETPOST('search_code_tiers_end', 'alpha');
if ($search_code_tiers_end == -1) {
    $search_code_tiers_end = '';
}
$search_label_compte = GETPOST('search_label_compte', 'alpha');
$search_sens = GETPOST('search_sens', 'alpha');
$search_code_journal = GETPOST('search_code_journal', 'alpha');
$object = new BookKeeping($db);
$form = new Form($db);
$formventilation = new FormVentilation($db);
// Filter
if (empty($search_date_start)) {
    $search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
    $search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y'));
}
if ($sortorder == "") {
    $sortorder = "ASC";
}
if ($sortfield == "") {
    $sortfield = "t.rowid";
}
$offset = $limit * $page;
llxHeader('', $langs->trans("Bookkeeping"));