NEW Can select fields to show on list of bank transaction
This commit is contained in:
parent
a7b1d4a61c
commit
630aab9124
@ -34,6 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||||
|
|
||||||
$langs->load("banks");
|
$langs->load("banks");
|
||||||
|
$langs->load("bills");
|
||||||
$langs->load("categories");
|
$langs->load("categories");
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
$langs->load("margins");
|
$langs->load("margins");
|
||||||
@ -42,7 +43,7 @@ $langs->load("margins");
|
|||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result=restrictedArea($user,'banque');
|
$result=restrictedArea($user,'banque');
|
||||||
|
|
||||||
$search_ref=GETPOST('search_ref','int');
|
$search_ref=GETPOST('search_ref','alpha');
|
||||||
$description=GETPOST("description",'alpha');
|
$description=GETPOST("description",'alpha');
|
||||||
$debit=GETPOST("debit",'alpha');
|
$debit=GETPOST("debit",'alpha');
|
||||||
$credit=GETPOST("credit",'alpha');
|
$credit=GETPOST("credit",'alpha');
|
||||||
@ -77,16 +78,16 @@ $extralabels = $extrafields->fetch_name_optionals_label('banktransaction');
|
|||||||
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
||||||
|
|
||||||
$arrayfields=array(
|
$arrayfields=array(
|
||||||
'b.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
'b.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
||||||
'b.date_commande'=>array('label'=>$langs->trans("OrderDateShort"), 'checked'=>1),
|
'b.dateo'=>array('label'=>$langs->trans("DateOperationShort"), 'checked'=>1),
|
||||||
'b.date_delivery'=>array('label'=>$langs->trans("DateDeliveryPlanned"), 'checked'=>1, 'enabled'=>empty($conf->global->ORDER_DISABLE_DELIVERY_DATE)),
|
'b.datev'=>array('label'=>$langs->trans("DateValueShort"), 'checked'=>1),
|
||||||
'b.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1),
|
'type'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
|
||||||
'b.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0),
|
'b.num_releve'=>array('label'=>$langs->trans("Numero"), 'checked'=>1),
|
||||||
'b.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0),
|
'description'=>array('label'=>$langs->trans("Description"), 'checked'=>1),
|
||||||
'b.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
'bu.label'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'position'=>500),
|
||||||
'b.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>600),
|
||||||
'b.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605),
|
||||||
'b.facture'=>array('label'=>$langs->trans("Billed"), 'checked'=>1, 'position'=>1000, 'enabled'=>(empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)))
|
'ba.ref'=>array('label'=>$langs->trans("Account"), 'checked'=>1, 'position'=>1000)
|
||||||
);
|
);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
@ -114,6 +115,8 @@ include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
|||||||
|
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
|
$search_dt_start='';
|
||||||
|
$search_dt_end='';
|
||||||
$description="";
|
$description="";
|
||||||
$type="";
|
$type="";
|
||||||
$debit="";
|
$debit="";
|
||||||
@ -249,10 +252,10 @@ if ($resql)
|
|||||||
|
|
||||||
// List of mass actions available
|
// List of mass actions available
|
||||||
$arrayofmassactions = array(
|
$arrayofmassactions = array(
|
||||||
'presend'=>$langs->trans("SendByMail"),
|
//'presend'=>$langs->trans("SendByMail"),
|
||||||
'builddoc'=>$langs->trans("PDFMerge"),
|
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
);
|
);
|
||||||
if ($user->rights->commande->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
//if ($user->rights->bank->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||||
if ($massaction == 'presend') $arrayofmassactions=array();
|
if ($massaction == 'presend') $arrayofmassactions=array();
|
||||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||||
|
|
||||||
@ -310,54 +313,102 @@ if ($resql)
|
|||||||
|
|
||||||
// Fields title
|
// Fields title
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'b.rowid','',$param,'',$sortfield,$sortorder);
|
if (! empty($arrayfields['b.rowid']['checked'])) print_liste_field_titre($arrayfields['b.rowid']['label'],$_SERVER['PHP_SELF'],'b.rowid','',$param,'',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans('DateOperationShort'),$_SERVER['PHP_SELF'],'b.dateo','',$param,'align="center"',$sortfield,$sortorder);
|
if (! empty($arrayfields['b.dateo']['checked'])) print_liste_field_titre($arrayfields['b.dateo']['label'],$_SERVER['PHP_SELF'],'b.dateo','',$param,'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans('Value'),$_SERVER['PHP_SELF'],'b.datev','',$param,'align="center"',$sortfield,$sortorder);
|
if (! empty($arrayfields['b.datev']['checked'])) print_liste_field_titre($arrayfields['b.datev']['label'],$_SERVER['PHP_SELF'],'b.datev','',$param,'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Type"),$_SERVER['PHP_SELF'],'','',$param,'align="center"',$sortfield,$sortorder);
|
if (! empty($arrayfields['type']['checked'])) print_liste_field_titre($arrayfields['type']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Numero"),$_SERVER['PHP_SELF'],'b.num_releve','',$param,'align="center"',$sortfield,$sortorder);
|
if (! empty($arrayfields['b.num_releve']['checked'])) print_liste_field_titre($arrayfields['b.num_releve']['label'],$_SERVER['PHP_SELF'],'b.num_releve','',$param,'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Description"),$_SERVER['PHP_SELF'],'','',$param,'',$sortfield,$sortorder);
|
if (! empty($arrayfields['description']['checked'])) print_liste_field_titre($arrayfields['description']['label'],$_SERVER['PHP_SELF'],'','',$param,'',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER['PHP_SELF'],'bu.label','',$param,'',$sortfield,$sortorder);
|
if (! empty($arrayfields['bu.label']['checked'])) print_liste_field_titre($arrayfields['bu.label']['label'],$_SERVER['PHP_SELF'],'bu.label','',$param,'',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Debit"),$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder);
|
if (! empty($arrayfields['b.debit']['checked'])) print_liste_field_titre($arrayfields['b.debit']['label'],$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Credit"),$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder);
|
if (! empty($arrayfields['b.credit']['checked'])) print_liste_field_titre($arrayfields['b.credit']['label'],$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Account"),$_SERVER['PHP_SELF'],'ba.ref','',$param,'align="right"',$sortfield,$sortorder);
|
if (! empty($arrayfields['ba.ref']['checked'])) print_liste_field_titre($arrayfields['ba.ref']['label'],$_SERVER['PHP_SELF'],'ba.ref','',$param,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre('');
|
// Extra fields
|
||||||
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
|
{
|
||||||
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
|
{
|
||||||
|
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||||
|
{
|
||||||
|
$align=$extrafields->getAlignFlag($key);
|
||||||
|
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Hook fields
|
||||||
|
$parameters=array('arrayfields'=>$arrayfields);
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td class="liste_titre">';
|
if (! empty($arrayfields['b.rowid']['checked']))
|
||||||
print '<input type="text" class="flat" name="search_ref" size="4" value="'.dol_escape_htmltag($search_ref).'">';
|
{
|
||||||
print '</td>';
|
print '<td class="liste_titre">';
|
||||||
print '<td class="liste_titre"> </td>';
|
print '<input type="text" class="flat" name="search_ref" size="4" value="'.dol_escape_htmltag($search_ref).'">';
|
||||||
print '<td class="liste_titre"> </td>';
|
print '</td>';
|
||||||
print '<td class="liste_titre" align="center">';
|
}
|
||||||
$form->select_types_paiements(empty($type)?'':$type, 'type', '', 2, 0, 1);
|
if (! empty($arrayfields['b.dateo']['checked']))
|
||||||
print '</td>';
|
{
|
||||||
// Numero
|
print '<td class="liste_titre"> </td>';
|
||||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" name="req_nb" value="'.dol_escape_htmltag($search_req_nb).'" size="2"></td>';
|
}
|
||||||
print '<td class="liste_titre">';
|
if (! empty($arrayfields['b.datev']['checked']))
|
||||||
print '<input type="text" class="flat" name="description" size="10" value="'.dol_escape_htmltag($description).'">';
|
{
|
||||||
print '</td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat" name="thirdparty" value="'.dol_escape_htmltag($search_thirdparty).'" size="10"></td>';
|
}
|
||||||
print '<td class="liste_titre" align="right">';
|
if (! empty($arrayfields['type']['checked']))
|
||||||
print '<input type="text" class="flat" name="debit" size="4" value="'.dol_escape_htmltag($debit).'">';
|
{
|
||||||
print '</td>';
|
print '<td class="liste_titre" align="center">';
|
||||||
print '<td class="liste_titre" align="right">';
|
$form->select_types_paiements(empty($type)?'':$type, 'type', '', 2, 0, 1);
|
||||||
print '<input type="text" class="flat" name="credit" size="4" value="'.dol_escape_htmltag($credit).'">';
|
print '</td>';
|
||||||
print '</td>';
|
}
|
||||||
print '<td align="right">';
|
if (! empty($arrayfields['b.num_releve']['checked']))
|
||||||
$form->select_comptes($account,'account',0,'',1);
|
{
|
||||||
print '</td>';
|
// Numero
|
||||||
print '<td class="liste_titre" align="right">';
|
print '<td class="liste_titre" align="center"><input type="text" class="flat" name="req_nb" value="'.dol_escape_htmltag($search_req_nb).'" size="2"></td>';
|
||||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
}
|
||||||
print $searchpitco;
|
if (! empty($arrayfields['description']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre">';
|
||||||
|
print '<input type="text" class="flat" name="description" size="10" value="'.dol_escape_htmltag($description).'">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
if (! empty($arrayfields['bu.label']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre"><input type="text" class="flat" name="thirdparty" value="'.dol_escape_htmltag($search_thirdparty).'" size="10"></td>';
|
||||||
|
}
|
||||||
|
if (! empty($arrayfields['b.debit']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre" align="right">';
|
||||||
|
print '<input type="text" class="flat" name="debit" size="4" value="'.dol_escape_htmltag($debit).'">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
if (! empty($arrayfields['b.credit']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre" align="right">';
|
||||||
|
print '<input type="text" class="flat" name="credit" size="4" value="'.dol_escape_htmltag($credit).'">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
if (! empty($arrayfields['ba.ref']['checked']))
|
||||||
|
{
|
||||||
|
print '<td align="right">';
|
||||||
|
$form->select_comptes($account,'account',0,'',1);
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
print '<td class="liste_titre" align="middle">';
|
||||||
|
$searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
|
||||||
|
print $searchpitco;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
// Loop on each record
|
// Loop on each record
|
||||||
$total_debit=0;
|
$totalarray=array();
|
||||||
$total_credit=0;
|
while ($i < min($num,$limit))
|
||||||
while ($i < min($num,$limit)) {
|
{
|
||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
|
|
||||||
|
// Why this ?
|
||||||
$printline=false;
|
$printline=false;
|
||||||
//Search Description
|
//Search Description
|
||||||
if ($description) {
|
if ($description) {
|
||||||
@ -372,98 +423,163 @@ if ($resql)
|
|||||||
} else {
|
} else {
|
||||||
$printline=true;
|
$printline=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($printline) {
|
if ($printline) {
|
||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|
||||||
print "<tr ".$bc[$var].">";
|
print "<tr ".$bc[$var].">";
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<td align="left" class="nowrap">';
|
if (! empty($arrayfields['b.rowid']['checked']))
|
||||||
print "<a href=\"ligne.php?rowid=".$objp->rowid.'">'.img_object($langs->trans("ShowPayment").': '.$objp->rowid, 'payment', 'class="classfortooltip"').' '.$objp->rowid."</a> ";
|
{
|
||||||
print '</td>';
|
print '<td align="left" class="nowrap">';
|
||||||
|
print "<a href=\"ligne.php?rowid=".$objp->rowid.'">'.img_object($langs->trans("ShowPayment").': '.$objp->rowid, 'payment', 'class="classfortooltip"').' '.$objp->rowid."</a> ";
|
||||||
|
print '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
// Date ope
|
// Date ope
|
||||||
print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($objp->do),"day")."</td>\n";
|
if (! empty($arrayfields['b.dateo']['checked']))
|
||||||
|
{
|
||||||
|
print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($objp->do),"day")."</td>\n";
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
// Date value
|
// Date value
|
||||||
print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($objp->dv),"day")."</td>\n";
|
if (! empty($arrayfields['b.datev']['checked']))
|
||||||
|
{
|
||||||
|
print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($objp->dv),"day")."</td>\n";
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
// Payment type
|
// Payment type
|
||||||
print '<td align="center" class="nowrap">';
|
if (! empty($arrayfields['type']['checked']))
|
||||||
$labeltype=($langs->trans("PaymentTypeShort".$objp->fk_type)!="PaymentTypeShort".$objp->fk_type)?$langs->trans("PaymentTypeShort".$objp->fk_type):$langs->getLabelFromKey($db,$objp->fk_type,'c_paiement','code','libelle');
|
{
|
||||||
if ($labeltype == 'SOLD') print ' '; //$langs->trans("InitialBankBalance");
|
print '<td align="center" class="nowrap">';
|
||||||
else print $labeltype;
|
$labeltype=($langs->trans("PaymentTypeShort".$objp->fk_type)!="PaymentTypeShort".$objp->fk_type)?$langs->trans("PaymentTypeShort".$objp->fk_type):$langs->getLabelFromKey($db,$objp->fk_type,'c_paiement','code','libelle');
|
||||||
print "</td>\n";
|
if ($labeltype == 'SOLD') print ' '; //$langs->trans("InitialBankBalance");
|
||||||
|
else print $labeltype;
|
||||||
|
print "</td>\n";
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
// Num
|
// Num
|
||||||
print '<td class="nowrap" align="center">'.($objp->num_chq?$objp->num_chq:"")."</td>\n";
|
if (! empty($arrayfields['b.num_releve']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="nowrap" align="center">'.($objp->num_chq?$objp->num_chq:"")."</td>\n";
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
print "<td>";
|
if (! empty($arrayfields['description']['checked']))
|
||||||
|
{
|
||||||
|
print "<td>";
|
||||||
|
|
||||||
print "<a href=\"ligne.php?rowid=".$objp->rowid."&account=".$objp->fk_account."\">";
|
print "<a href=\"ligne.php?rowid=".$objp->rowid."&account=".$objp->fk_account."\">";
|
||||||
$reg=array();
|
$reg=array();
|
||||||
preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parenthee on tente recherche de traduction
|
preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parenthee on tente recherche de traduction
|
||||||
if ($reg[1] && $langs->trans($reg[1])!=$reg[1]) print $langs->trans($reg[1]);
|
if ($reg[1] && $langs->trans($reg[1])!=$reg[1]) print $langs->trans($reg[1]);
|
||||||
else print dol_trunc($objp->label,40);
|
else print dol_trunc($objp->label,40);
|
||||||
print "</a> ";
|
print "</a> ";
|
||||||
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
// Third party
|
// Third party
|
||||||
print "<td>";
|
if (! empty($arrayfields['bu.label']['checked']))
|
||||||
if ($objp->url_id)
|
{
|
||||||
{
|
print "<td>";
|
||||||
$companystatic->id=$objp->url_id;
|
if ($objp->url_id)
|
||||||
$companystatic->name=$objp->nom;
|
{
|
||||||
$companystatic->name_alias=$objp->name_alias;
|
$companystatic->id=$objp->url_id;
|
||||||
$companystatic->client=$objp->client;
|
$companystatic->name=$objp->nom;
|
||||||
$companystatic->fournisseur=$objp->fournisseur;
|
$companystatic->name_alias=$objp->name_alias;
|
||||||
$companystatic->code_client=$objp->code_client;
|
$companystatic->client=$objp->client;
|
||||||
$companystatic->code_fournisseur=$objp->code_fournisseur;
|
$companystatic->fournisseur=$objp->fournisseur;
|
||||||
print $companystatic->getNomUrl(1);
|
$companystatic->code_client=$objp->code_client;
|
||||||
}
|
$companystatic->code_fournisseur=$objp->code_fournisseur;
|
||||||
else
|
print $companystatic->getNomUrl(1);
|
||||||
{
|
}
|
||||||
print ' ';
|
else
|
||||||
}
|
{
|
||||||
print '</td>';
|
print ' ';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
// Debit/Credit
|
// Debit
|
||||||
if ($objp->amount < 0)
|
if (! empty($arrayfields['b.debit']['checked']))
|
||||||
{
|
{
|
||||||
print '<td align="right">'.price($objp->amount * -1)."</td><td> </td>\n";
|
print '<td align="right">';
|
||||||
$total_debit+=$objp->amount;
|
if ($objp->amount < 0)
|
||||||
}
|
{
|
||||||
else
|
print price($objp->amount * -1);
|
||||||
{
|
$totalarray['totaldeb'] += $objp->amount;
|
||||||
print "<td> </td><td align=\"right\">".price($objp->amount)."</td>\n";
|
}
|
||||||
$total_credit+=$objp->amount;
|
print "</td>\n";
|
||||||
}
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
if (! $i) $totalarray['totaldebfield']=$totalarray['nbfield'];
|
||||||
|
}
|
||||||
|
// Credit
|
||||||
|
if (! empty($arrayfields['b.credit']['checked']))
|
||||||
|
{
|
||||||
|
print '<td align="right">';
|
||||||
|
if ($objp->amount > 0)
|
||||||
|
{
|
||||||
|
print price($objp->amount);
|
||||||
|
$totalarray['totalcred'] += $objp->amount;
|
||||||
|
}
|
||||||
|
print "</td>\n";
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
if (! $i) $totalarray['totalcredfield']=$totalarray['nbfield'];
|
||||||
|
}
|
||||||
|
|
||||||
// Bank account
|
// Bank account
|
||||||
print '<td align="right" class="nowrap">';
|
if (! empty($arrayfields['ba.ref']['checked']))
|
||||||
$bankaccountstatic->id=$objp->bankid;
|
{
|
||||||
$bankaccountstatic->label=$objp->bankref;
|
print '<td align="right" class="nowrap">';
|
||||||
print $bankaccountstatic->getNomUrl(1);
|
$bankaccountstatic->id=$objp->bankid;
|
||||||
print "</td>\n";
|
$bankaccountstatic->label=$objp->bankref;
|
||||||
|
print $bankaccountstatic->getNomUrl(1);
|
||||||
|
print "</td>\n";
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
print '<td></td>';
|
// Action column
|
||||||
|
print '<td class="nowrap" align="center">';
|
||||||
|
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||||
|
{
|
||||||
|
$selected=0;
|
||||||
|
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
|
||||||
|
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
if ($num>0) {
|
|
||||||
print '<tr class="liste_total">';
|
// Show total line
|
||||||
print '<td>' . $langs->trans('Total') . '</td>';
|
if (isset($totalarray['totaldebfield']) || isset($totalarray['totalcredfield']))
|
||||||
print '<td colspan="6"></td>';
|
{
|
||||||
print '<td align="right">' . price($total_debit * - 1) . '</td>';
|
print '<tr class="liste_total">';
|
||||||
print '<td align="right">' . price($total_credit) . '</td>';
|
$i=0;
|
||||||
print '<td></td>';
|
while ($i < $totalarray['nbfield'])
|
||||||
print '<td></td>';
|
{
|
||||||
print '</tr>';
|
$i++;
|
||||||
|
if ($i == 1)
|
||||||
|
{
|
||||||
|
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||||
|
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||||
|
}
|
||||||
|
elseif ($totalarray['totaldebfield'] == $i) print '<td align="right">'.price(-1 * $totalarray['totaldeb']).'</td>';
|
||||||
|
elseif ($totalarray['totalcredfield'] == $i) print '<td align="right">'.price($totalarray['totalcred']).'</td>';
|
||||||
|
else print '<td></td>';
|
||||||
|
}
|
||||||
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user