29 require
'../../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/bookkeeping.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/lettering.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
38 $langs->loadLangs(array(
"compta",
"accountancy"));
40 $action =
GETPOST(
'action',
'aZ09');
41 $massaction =
GETPOST(
'massaction',
'alpha');
42 $show_files =
GETPOST(
'show_files',
'int');
43 $confirm =
GETPOST(
'confirm',
'alpha');
44 $toselect =
GETPOST(
'toselect',
'array');
47 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
48 $sortfield =
GETPOST(
"sortfield",
'alpha');
49 $sortorder =
GETPOST(
"sortorder",
'alpha');
51 if (empty($page) || $page == - 1) {
54 $offset = $limit * $page;
55 $pageprev = $page - 1;
56 $pagenext = $page + 1;
60 $sortfield =
"bk.doc_date";
69 $lettering =
GETPOST(
'lettering',
'alpha');
70 if (!empty($lettering)) {
85 $socid =
GETPOST(
"socid",
'int');
91 $result = $object->fetch($socid);
102 if ($action ==
'lettering') {
103 $result = $lettering->updateLettering($toselect);
127 $form =
new Form($db);
130 $title = $object->name.
" - ".$langs->trans(
'TabLetteringCustomer');
131 $help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
140 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
142 dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom',
'',
'', 0,
'',
'',
'arearefnobottom');
146 $sql =
"SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
147 $sql .=
" bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
148 $sql .=
" bk.credit, bk.montant, bk.sens, bk.code_journal, bk.piece_num, bk.lettering_code";
149 $sql .=
" FROM ".MAIN_DB_PREFIX.
"accounting_bookkeeping as bk";
150 $sql .=
" WHERE (bk.subledger_account = '".$db->escape($object->code_compta).
"' AND bk.numero_compte = '".$db->escape($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER).
"' )";
158 $sql .=
' AND bk.entity IN ('.getEntity(
'accountingbookkeeping').
')';
159 $sql .= $db->order($sortfield, $sortorder);
165 $nbtotalofrecords =
'';
166 $resql = $db->query($sql);
171 $nbtotalofrecords = $db->num_rows(
$resql);
173 while ($obj = $db->fetch_object(
$resql)) {
174 $debit += $obj->debit;
175 $credit += $obj->credit;
177 $solde += ($obj->credit - $obj->debit);
180 $sql .= $db->plimit($limit + 1, $offset);
182 dol_syslog(
"/accountancy/bookkeeping/thirdparty_lettering_customer.php", LOG_DEBUG);
183 $resql = $db->query($sql);
190 $param .=
"&socid=".urlencode($socid);
192 $num = $db->num_rows(
$resql);
194 dol_syslog(
"/accountancy/bookkeeping/thirdparty_lettering_customer.php", LOG_DEBUG);
198 $param =
"&socid=".$socid;
199 print '<form name="add" action="'.$_SERVER[
"PHP_SELF"].
'?socid='.$object->id.
'" method="POST">';
200 print '<input type="hidden" name="token" value="'.newToken().
'">';
201 print '<input type="hidden" name="socid" value="'.$object->id.
'">';
203 $letteringbutton =
'<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>';
205 print_barre_liste($title, $page,
$_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'title_companies', 0, $letteringbutton,
'', $limit);
207 print '<div class="div-table-responsive-no-min">';
208 print '<table class="liste centpercent">'.
"\n";
237 print '<tr class="liste_titre">';
253 while ($obj = $db->fetch_object(
$resql)) {
254 if ($tmp != $obj->lettering_code || empty($tmp)) $tmp = $obj->lettering_code;
255 $solde += ($obj->credit - $obj->debit);
257 print '<tr class="oddeven">';
260 print '<td class="center">'.dol_print_date($db->jdate($obj->doc_date),
'day').
'</td>';
261 print '<td>'.$obj->doc_ref.
'</td>';
262 print '<td>'.$obj->label_compte.
'</td>';
263 print '<td class="nowrap right">'.price($obj->debit).
'</td>';
264 print '<td class="nowrap right">'.price($obj->credit).
'</td>';
265 print '<td class="nowrap right">'.price(round($solde, 2)).
'</td>';
269 $result = $accountingjournal->fetch(
'', $obj->code_journal);
270 $journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0,
'', 0) : $obj->code_journal);
271 print '<td class="center">'.$journaltoshow.
'</td>';
273 if (empty($obj->lettering_code)) {
274 print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="'.$obj->rowid.
'" /></td>';
275 print '<td><a href="'.DOL_URL_ROOT.
'/accountancy/bookkeeping/card.php?piece_num='.$obj->piece_num.
'">';
277 print '</a></td>'.
"\n";
279 print '<td class="center">'.$obj->lettering_code.
'</td>';
286 print '<tr class="oddeven">';
287 print '<td class="right" colspan="3">'.$langs->trans(
"Total").
':</td>'.
"\n";
288 print '<td class="nowrap right"><strong>'.price($debit).
'</strong></td>';
289 print '<td class="nowrap right"><strong>'.price($credit).
'</strong></td>';
290 print '<td colspan="4"></td>';
293 print '<tr class="oddeven">';
294 print '<td class="right" colspan="3">'.$langs->trans(
"Balancing").
':</td>'.
"\n";
295 print '<td colspan="2"> </td>';
296 print '<td class="nowrap right"><strong>'.price($credit - $debit).
'</strong></td>';
297 print '<td colspan="6"></td>';
302 print '<div class="tabsAction tabsActionNoBottom">'.
"\n";
303 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_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.