28 require
'../../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/bookkeeping.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/lettering.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
37 $langs->loadLangs(array(
"compta",
"accountancy"));
39 $action =
GETPOST(
'action',
'aZ09');
40 $massaction =
GETPOST(
'massaction',
'alpha');
41 $show_files =
GETPOST(
'show_files',
'int');
42 $confirm =
GETPOST(
'confirm',
'alpha');
43 $toselect =
GETPOST(
'toselect',
'array');
46 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
47 $sortfield =
GETPOST(
"sortfield",
'alpha');
48 $sortorder =
GETPOST(
"sortorder",
'alpha');
50 if (empty($page) || $page == - 1) {
53 $offset = $limit * $page;
54 $pageprev = $page - 1;
55 $pagenext = $page + 1;
59 $sortfield =
"bk.doc_date";
68 $lettering =
GETPOST(
'lettering',
'alpha');
69 if (!empty($lettering)) {
85 $socid =
GETPOST(
"socid",
'int');
91 $result = $object->fetch($socid);
101 if ($action ==
'lettering') {
102 $result = $lettering->updateLettering($toselect);
126 $form =
new Form($db);
129 $title = $object->name.
" - ".$langs->trans(
'TabLetteringSupplier');
130 $help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
139 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
141 dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom',
'',
'', 0,
'',
'',
'arearefnobottom');
145 $sql =
"SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
146 $sql .=
" bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
147 $sql .=
" bk.credit, bk.montant, bk.sens, bk.code_journal, bk.piece_num, bk.lettering_code, bk.date_validated ";
148 $sql .=
" FROM ".MAIN_DB_PREFIX.
"accounting_bookkeeping as bk";
149 $sql .=
" WHERE (bk.subledger_account = '".$db->escape($object->code_compta_fournisseur).
"' AND bk.numero_compte = '".$db->escape($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER).
"' )";
151 $sql .=
" AND (bk.doc_date BETWEEN '".$db->idate($search_date_start).
"' AND '".$db->idate($search_date_end).
"' )";
153 $sql .=
' AND bk.entity IN ('.getEntity(
'accountingbookkeeping').
')';
154 $sql .= $db->order($sortfield, $sortorder);
160 $nbtotalofrecords =
'';
161 $resql = $db->query($sql);
167 $nbtotalofrecords = $db->num_rows(
$resql);
169 while ($obj = $db->fetch_object(
$resql)) {
170 $debit += $obj->debit;
171 $credit += $obj->credit;
173 $solde += ($obj->credit - $obj->debit);
176 $sql .= $db->plimit($limit + 1, $offset);
178 dol_syslog(
"/accountancy/bookkeeping/thirdparty_lettering_supplier.php", LOG_DEBUG);
179 $resql = $db->query($sql);
186 $param .=
"&socid=".urlencode($socid);
188 $num = $db->num_rows(
$resql);
190 dol_syslog(
"/accountancy/bookkeeping/thirdparty_lettering_supplier.php", LOG_DEBUG);
191 $resql = $db->query($sql);
193 $num = $db->num_rows(
$resql);
196 $param =
"&socid=".$socid;
197 print '<form name="add" action="'.$_SERVER[
"PHP_SELF"].
'?socid='.$object->id.
'" method="POST">';
198 print '<input type="hidden" name="token" value="'.newToken().
'">';
199 print '<input type="hidden" name="socid" value="'.$object->id.
'">';
201 $letteringbutton =
'<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>';
203 print_barre_liste($title, $page,
$_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'title_companies', 0, $letteringbutton,
'', $limit);
205 print '<div class="div-table-responsive-no-min">';
206 print '<table class="liste centpercent">'.
"\n";
235 print '<tr class="liste_titre">';
250 while ($obj = $db->fetch_object(
$resql)) {
251 if ($tmp != $obj->lettering_code || empty($tmp)) $tmp = $obj->lettering_code;
252 $solde += ($obj->credit - $obj->debit);
254 print '<tr class="oddeven">';
257 print '<td class="center">'.dol_print_date($db->jdate($obj->doc_date),
'day').
'</td>';
258 print '<td>'.$obj->doc_ref.
'</td>';
259 print '<td>'.$obj->label_compte.
'</td>';
260 print '<td class="nowrap right">'.price($obj->debit).
'</td>';
261 print '<td class="nowrap right">'.price($obj->credit).
'</td>';
262 print '<td class="nowrap right">'.price(round($solde, 2)).
'</td>';
266 $result = $accountingjournal->fetch(
'', $obj->code_journal);
267 $journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0,
'', 0) : $obj->code_journal);
268 print '<td class="center">'.$journaltoshow.
'</td>';
270 if (empty($obj->lettering_code) && empty($obj->date_validated)) {
271 print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="'.$obj->rowid.
'" /></td>';
272 print '<td><a href="'.DOL_URL_ROOT.
'/accountancy/bookkeeping/card.php?piece_num='.$obj->piece_num.
'">';
274 print '</a></td>'.
"\n";
276 print '<td class="center">'.$obj->lettering_code.
'</td>';
283 print '<tr class="oddeven">';
284 print '<td class="right" colspan="3">'.$langs->trans(
"Total").
':</td>'.
"\n";
285 print '<td class="nowrap right"><strong>'.price($debit).
'</strong></td>';
286 print '<td class="nowrap right"><strong>'.price($credit).
'</strong></td>';
287 print '<td colspan="6"></td>';
290 print '<tr class="oddeven">';
291 print '<td class="right" colspan="3">'.$langs->trans(
"Balancing").
':</td>'.
"\n";
292 print '<td colspan="2"> </td>';
293 print '<td class="nowrap right"><strong>'.price($credit - $debit).
'</strong></td>';
294 print '<td colspan="4"></td>';
299 print '<div class="tabsAction tabsActionNoBottom">'.
"\n";
300 print $letteringbutton;
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
img_edit($titlealt= 'default', $float=0, $other= '')
Show logo editer/modifier fiche.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options= '', $sortfield= '', $sortorder= '', $morehtmlcenter= '', $num=-1, $totalnboflines= '', $picto= 'generic', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow= '')
Print a title with navigation controls for pagination.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage third parties objects (customers, suppliers, prospects...)
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dol_strlen($string, $stringencoding= 'UTF-8')
Make a strlen call.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
dol_htmloutput_mesg($mesgstring= '', $mesgarray=array(), $style= 'ok', $keepembedded=0)
Print formated messages to output (Used to show messages on html output).
print
Draft customers invoices.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Class to manage accounting accounts.
dol_banner_tab($object, $paramid, $morehtml= '', $shownav=1, $fieldid= 'rowid', $fieldref= 'ref', $morehtmlref= '', $moreparam= '', $nodbprefix=0, $morehtmlleft= '', $morehtmlstatus= '', $onlybanner=0, $morehtmlright= '')
Show tab footer of a card.