start clean indent in compta directory

This commit is contained in:
Frédéric FRANCE 2019-10-26 14:42:25 +02:00
parent 1a10b30a76
commit 79825e2193
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
11 changed files with 380 additions and 382 deletions

View File

@ -186,7 +186,7 @@
<!-- Check indent are done with spaces and with correct number -->
<!-- Disabled as this does not support tab -->
<!-- <rule ref="Generic.WhiteSpace.ScopeIndent" /> -->
<!-- TODO Enable this
<arg name="tab-width" value="4"/>
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
@ -194,7 +194,7 @@
<property name="tabIndent" value="true"/>
</properties>
</rule>
-->
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace.Indent" />

View File

@ -306,7 +306,7 @@ else
$log="graph.php: min=".$min." max=".$max;
dol_syslog($log);
// CRED PART
// CRED PART
// Chargement du tableau des années
$tblyear[0] = array();
$tblyear[1] = array();
@ -393,7 +393,7 @@ else
unset($tblyear[1]);
unset($tblyear[2]);
// DEDBT PART
// DEDBT PART
// Chargement du tableau des années
$tblyear[0] = array();
$tblyear[1] = array();

View File

@ -1315,33 +1315,33 @@ if ($resql)
// Date ope
if (! empty($arrayfields['b.dateo']['checked']))
{
print '<td align="center" class="nowrap">';
print '<span id="dateoperation_'.$objp->rowid.'">'.dol_print_date($db->jdate($objp->do), "day")."</span>";
print '&nbsp;';
print '<span class="inline-block">';
print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=doprev&amp;account='.$objp->bankid.'&amp;rowid='.$objp->rowid.'">';
print img_edit_remove() . "</a> ";
print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=donext&amp;account='.$objp->bankid.'&amp;rowid='.$objp->rowid.'">';
print img_edit_add() ."</a>";
print '</span>';
print "</td>\n";
print '<td align="center" class="nowrap">';
print '<span id="dateoperation_'.$objp->rowid.'">'.dol_print_date($db->jdate($objp->do), "day")."</span>";
print '&nbsp;';
print '<span class="inline-block">';
print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=doprev&amp;account='.$objp->bankid.'&amp;rowid='.$objp->rowid.'">';
print img_edit_remove() . "</a> ";
print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=donext&amp;account='.$objp->bankid.'&amp;rowid='.$objp->rowid.'">';
print img_edit_add() ."</a>";
print '</span>';
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
}
// Date value
if (! empty($arrayfields['b.datev']['checked']))
{
print '<td align="center" class="nowrap">';
print '<span id="datevalue_'.$objp->rowid.'">'.dol_print_date($db->jdate($objp->dv), "day")."</span>";
print '&nbsp;';
print '<span class="inline-block">';
print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=dvprev&amp;account='.$objp->bankid.'&amp;rowid='.$objp->rowid.'">';
print img_edit_remove() . "</a> ";
print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=dvnext&amp;account='.$objp->bankid.'&amp;rowid='.$objp->rowid.'">';
print img_edit_add() ."</a>";
print '</span>';
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
print '<td align="center" class="nowrap">';
print '<span id="datevalue_'.$objp->rowid.'">'.dol_print_date($db->jdate($objp->dv), "day")."</span>";
print '&nbsp;';
print '<span class="inline-block">';
print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=dvprev&amp;account='.$objp->bankid.'&amp;rowid='.$objp->rowid.'">';
print img_edit_remove() . "</a> ";
print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=dvnext&amp;account='.$objp->bankid.'&amp;rowid='.$objp->rowid.'">';
print img_edit_add() ."</a>";
print '</span>';
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
}
// Payment type
@ -1352,7 +1352,7 @@ if ($resql)
if ($labeltype == 'SOLD') print '&nbsp;'; //$langs->trans("InitialBankBalance");
else print $labeltype;
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['nbfield']++;
}
// Num cheque

View File

@ -322,7 +322,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
print '</tr>';
print "</table>";
print "</div>";
print "</div>";
}
else
{

View File

@ -427,19 +427,20 @@ if ($id)
$morehtmlref.=$langs->trans('Project') . ' ';
if ($user->rights->banque->modifier)
{
if ($action != 'classify')
if ($action != 'classify') {
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.=$formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
} else {
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
}
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.=$formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
} else {
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);

View File

@ -92,19 +92,20 @@ if ($object->id)
$morehtmlref.=$langs->trans('Project') . ' : ';
if ($user->rights->banque->modifier && 0)
{
if ($action != 'classify')
if ($action != 'classify') {
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.=$formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
} else {
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
}
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.=$formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
} else {
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);

View File

@ -61,19 +61,20 @@ if (! empty($conf->projet->enabled))
$morehtmlref.=$langs->trans('Project') . ' : ';
if ($user->rights->banque->modifier && 0)
{
if ($action != 'classify')
if ($action != 'classify') {
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.=$formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
} else {
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
}
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.=$formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
} else {
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);

View File

@ -415,9 +415,9 @@ elseif ($id)
}
else
{
/*
* Confirm delete trip
*/
/*
* Confirm delete trip
*/
if ($action == 'delete')
{
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id, $langs->trans("DeleteTrip"), $langs->trans("ConfirmDeleteTrip"), "confirm_delete");

View File

@ -89,11 +89,11 @@ class Deplacement extends CommonObject
public $statuts=array();
public $statuts_short=array();
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
$this->db = $db;
@ -249,13 +249,13 @@ class Deplacement extends CommonObject
}
}
/**
* Load an object from database
*
* @param int $id Id of record to load
* @param string $ref Ref of record
* @return int <0 if KO, >0 if OK
*/
/**
* Load an object from database
*
* @param int $id Id of record to load
* @param string $ref Ref of record
* @return int <0 if KO, >0 if OK
*/
public function fetch($id, $ref = '')
{
$sql = "SELECT rowid, fk_user, type, fk_statut, km, fk_soc, dated, note_private, note_public, fk_projet as fk_project, extraparams";
@ -293,12 +293,12 @@ class Deplacement extends CommonObject
}
}
/**
* Delete record
*
* @param int $id Id of record to delete
* @return int <0 if KO, >0 if OK
*/
/**
* Delete record
*
* @param int $id Id of record to delete
* @return int <0 if KO, >0 if OK
*/
public function delete($id)
{
$this->db->begin();
@ -413,9 +413,9 @@ class Deplacement extends CommonObject
*/
public function listOfTypes($active = 1)
{
global $langs;
global $langs;
$ret=array();
$ret=array();
$sql = "SELECT id, code, label";
$sql.= " FROM ".MAIN_DB_PREFIX."c_type_fees";

View File

@ -320,323 +320,318 @@ else
$span=$columns;
if ($modetax != 1) $span+=2;
//if ($modetax == 0 || $modetax == 2)
//{
// Customers invoices
print '<tr class="liste_titre">';
print '<td class="left">'.$elementcust.'</td>';
print '<td class="left">'.$productcust.'</td>';
if ($modetax != 2) print '<td class="right">'.$amountcust.'</td>';
if ($modetax != 1) print '<td class="right">'.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')</td>';
print '<td class="right">'.$langs->trans("BI").'</td>';
print '<td class="right">'.$vatcust.'</td>';
print '</tr>';
// Customers invoices
print '<tr class="liste_titre">';
print '<td class="left">'.$elementcust.'</td>';
print '<td class="left">'.$productcust.'</td>';
if ($modetax != 2) print '<td class="right">'.$amountcust.'</td>';
if ($modetax != 1) print '<td class="right">'.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')</td>';
print '<td class="right">'.$langs->trans("BI").'</td>';
print '<td class="right">'.$vatcust.'</td>';
print '</tr>';
$LT=0;
$sameLT=false;
foreach(array_keys($x_coll) as $rate)
$LT=0;
$sameLT=false;
foreach(array_keys($x_coll) as $rate)
{
$subtot_coll_total_ht = 0;
$subtot_coll_vat = 0;
if (is_array($x_both[$rate]['coll']['detail']))
{
$subtot_coll_total_ht = 0;
$subtot_coll_vat = 0;
if (is_array($x_both[$rate]['coll']['detail']))
// VAT Rate
if($rate!=0){
print "<tr>";
print '<td class="tax_rate">'.$langs->trans("Rate").': '.vatrate($rate).'%</td><td colspan="'.$span.'"></td>';
print '</tr>'."\n";
}
foreach($x_both[$rate]['coll']['detail'] as $index => $fields)
{
// VAT Rate
if($rate!=0){
print "<tr>";
print '<td class="tax_rate">'.$langs->trans("Rate").': '.vatrate($rate).'%</td><td colspan="'.$span.'"></td>';
print '</tr>'."\n";
}
foreach($x_both[$rate]['coll']['detail'] as $index => $fields)
if(($local==1 && $fields['localtax1']!=0) || ($local==2 && $fields['localtax2']!=0))
{
if(($local==1 && $fields['localtax1']!=0) || ($local==2 && $fields['localtax2']!=0))
// Define type
$type=($fields['dtype']?$fields['dtype']:$fields['ptype']);
// Try to enhance type detection using date_start and date_end for free lines where type
// was not saved.
if (! empty($fields['ddate_start'])) $type=1;
if (! empty($fields['ddate_end'])) $type=1;
print '<tr class="oddeven">';
// Ref
print '<td class="nowrap left">'.$fields['link'].'</td>';
// Description
print '<td class="left">';
if ($fields['pid'])
{
// Define type
$type=($fields['dtype']?$fields['dtype']:$fields['ptype']);
// Try to enhance type detection using date_start and date_end for free lines where type
// was not saved.
if (! empty($fields['ddate_start'])) $type=1;
if (! empty($fields['ddate_end'])) $type=1;
print '<tr class="oddeven">';
// Ref
print '<td class="nowrap left">'.$fields['link'].'</td>';
// Description
print '<td class="left">';
if ($fields['pid'])
{
$product_static->id=$fields['pid'];
$product_static->ref=$fields['pref'];
$product_static->type=$fields['ptype'];
print $product_static->getNomUrl(1);
if (dol_string_nohtmltag($fields['descr'])) print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16);
}
else
{
if ($type) $text = img_object($langs->trans('Service'), 'service');
else $text = img_object($langs->trans('Product'), 'product');
if (preg_match('/^\((.*)\)$/', $fields['descr'], $reg))
{
if ($reg[1]=='DEPOSIT') $fields['descr']=$langs->transnoentitiesnoconv('Deposit');
elseif ($reg[1]=='CREDIT_NOTE') $fields['descr']=$langs->transnoentitiesnoconv('CreditNote');
else $fields['descr']=$langs->transnoentitiesnoconv($reg[1]);
}
print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16);
// Show range
print_date_range($fields['ddate_start'], $fields['ddate_end']);
}
print '</td>';
// Total HT
if ($modetax != 2)
{
print '<td class="nowrap right">';
print price($fields['totalht']);
if (price2num($fields['ftotal_ttc']))
{
$ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']);
}
print '</td>';
}
// Payment
$ratiopaymentinvoice=1;
if ($modetax != 1)
{
if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']);
print '<td class="nowrap right">';
if ($fields['payment_amount'] && $fields['ftotal_ttc'])
{
$payment_static->id=$fields['payment_id'];
print $payment_static->getNomUrl(2);
}
if ($type == 0)
{
print $langs->trans("NotUsedForGoods");
}
else {
print price($fields['payment_amount']);
if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice*100, 2).'%)';
}
print '</td>';
}
// Total collected
print '<td class="nowrap right">';
$temp_ht=$fields['totalht'];
if ($type == 1) $temp_ht=$fields['totalht']*$ratiopaymentinvoice;
print price(price2num($temp_ht, 'MT'));
print '</td>';
// Localtax
print '<td class="nowrap right">';
$temp_vat= $local==1?$fields['localtax1']:$fields['localtax2'];
print price(price2num($temp_vat, 'MT'));
//print price($fields['vat']);
print '</td>';
print '</tr>';
$subtot_coll_total_ht += $temp_ht;
$subtot_coll_vat += $temp_vat;
$x_coll_sum += $temp_vat;
$product_static->id=$fields['pid'];
$product_static->ref=$fields['pref'];
$product_static->type=$fields['ptype'];
print $product_static->getNomUrl(1);
if (dol_string_nohtmltag($fields['descr'])) print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16);
}
else
{
if ($type) $text = img_object($langs->trans('Service'), 'service');
else $text = img_object($langs->trans('Product'), 'product');
if (preg_match('/^\((.*)\)$/', $fields['descr'], $reg))
{
if ($reg[1]=='DEPOSIT') $fields['descr']=$langs->transnoentitiesnoconv('Deposit');
elseif ($reg[1]=='CREDIT_NOTE') $fields['descr']=$langs->transnoentitiesnoconv('CreditNote');
else $fields['descr']=$langs->transnoentitiesnoconv($reg[1]);
}
print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16);
// Show range
print_date_range($fields['ddate_start'], $fields['ddate_end']);
}
print '</td>';
// Total HT
if ($modetax != 2)
{
print '<td class="nowrap right">';
print price($fields['totalht']);
if (price2num($fields['ftotal_ttc']))
{
$ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']);
}
print '</td>';
}
// Payment
$ratiopaymentinvoice=1;
if ($modetax != 1)
{
if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']);
print '<td class="nowrap right">';
if ($fields['payment_amount'] && $fields['ftotal_ttc'])
{
$payment_static->id=$fields['payment_id'];
print $payment_static->getNomUrl(2);
}
if ($type == 0)
{
print $langs->trans("NotUsedForGoods");
}
else {
print price($fields['payment_amount']);
if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice*100, 2).'%)';
}
print '</td>';
}
// Total collected
print '<td class="nowrap right">';
$temp_ht=$fields['totalht'];
if ($type == 1) $temp_ht=$fields['totalht']*$ratiopaymentinvoice;
print price(price2num($temp_ht, 'MT'));
print '</td>';
// Localtax
print '<td class="nowrap right">';
$temp_vat= $local==1?$fields['localtax1']:$fields['localtax2'];
print price(price2num($temp_vat, 'MT'));
//print price($fields['vat']);
print '</td>';
print '</tr>';
$subtot_coll_total_ht += $temp_ht;
$subtot_coll_vat += $temp_vat;
$x_coll_sum += $temp_vat;
}
}
// Total customers for this vat rate
print '<tr class="liste_total">';
print '<td></td>';
print '<td class="right">'.$langs->trans("Total").':</td>';
if ($modetax != 1)
{
print '<td class="nowrap right">&nbsp;</td>';
print '<td class="right">&nbsp;</td>';
}
print '<td class="right">'.price(price2num($subtot_coll_total_ht, 'MT')).'</td>';
print '<td class="nowrap right">'.price(price2num($subtot_coll_vat, 'MT')).'</td>';
print '</tr>';
}
if (count($x_coll) == 0) // Show a total ine if nothing shown
// Total customers for this vat rate
print '<tr class="liste_total">';
print '<td></td>';
print '<td class="right">'.$langs->trans("Total").':</td>';
if ($modetax != 1)
{
print '<tr class="liste_total">';
print '<td>&nbsp;</td>';
print '<td class="right">'.$langs->trans("Total").':</td>';
if ($modetax == 0)
{
print '<td class="nowrap right">&nbsp;</td>';
print '<td class="right">&nbsp;</td>';
}
print '<td class="right">'.price(price2num(0, 'MT')).'</td>';
print '<td class="nowrap right">'.price(price2num(0, 'MT')).'</td>';
print '</tr>';
print '<td class="nowrap right">&nbsp;</td>';
print '<td class="right">&nbsp;</td>';
}
print '<td class="right">'.price(price2num($subtot_coll_total_ht, 'MT')).'</td>';
print '<td class="nowrap right">'.price(price2num($subtot_coll_vat, 'MT')).'</td>';
print '</tr>';
}
// Blank line
print '<tr><td colspan="'.($span+1).'">&nbsp;</td></tr>';
print '</table>';
$diff=$x_coll_sum;
//}
if (count($x_coll) == 0) // Show a total ine if nothing shown
{
print '<tr class="liste_total">';
print '<td>&nbsp;</td>';
print '<td class="right">'.$langs->trans("Total").':</td>';
if ($modetax == 0)
{
print '<td class="nowrap right">&nbsp;</td>';
print '<td class="right">&nbsp;</td>';
}
print '<td class="right">'.price(price2num(0, 'MT')).'</td>';
print '<td class="nowrap right">'.price(price2num(0, 'MT')).'</td>';
print '</tr>';
}
//if($conf->global->$calc ==0 || $conf->global->$calc == 1){
echo '<table class="noborder" width="100%">';
//print table headers for this quadri - expenses now
print '<tr class="liste_titre">';
print '<td class="left">'.$elementsup.'</td>';
print '<td class="left">'.$productsup.'</td>';
if ($modetax != 1)
// Blank line
print '<tr><td colspan="'.($span+1).'">&nbsp;</td></tr>';
print '</table>';
$diff=$x_coll_sum;
echo '<table class="noborder" width="100%">';
//print table headers for this quadri - expenses now
print '<tr class="liste_titre">';
print '<td class="left">'.$elementsup.'</td>';
print '<td class="left">'.$productsup.'</td>';
if ($modetax != 1)
{
print '<td class="right">'.$amountsup.'</td>';
print '<td class="right">'.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')</td>';
}
print '<td class="right">'.$langs->trans("BI").'</td>';
print '<td class="right">'.$vatsup.'</td>';
print '</tr>'."\n";
foreach(array_keys($x_paye) as $rate)
{
$subtot_paye_total_ht = 0;
$subtot_paye_vat = 0;
if (is_array($x_both[$rate]['paye']['detail']))
{
print '<td class="right">'.$amountsup.'</td>';
print '<td class="right">'.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')</td>';
}
print '<td class="right">'.$langs->trans("BI").'</td>';
print '<td class="right">'.$vatsup.'</td>';
print '</tr>'."\n";
foreach(array_keys($x_paye) as $rate)
{
$subtot_paye_total_ht = 0;
$subtot_paye_vat = 0;
if (is_array($x_both[$rate]['paye']['detail']))
if($rate!=0){
print "<tr>";
print '<td class="tax_rate">'.$langs->trans("Rate").': '.vatrate($rate).'%</td><td colspan="'.$span.'"></td>';
print '</tr>'."\n";
}
foreach($x_both[$rate]['paye']['detail'] as $index=>$fields)
{
if($rate!=0){
print "<tr>";
print '<td class="tax_rate">'.$langs->trans("Rate").': '.vatrate($rate).'%</td><td colspan="'.$span.'"></td>';
print '</tr>'."\n";
}
foreach($x_both[$rate]['paye']['detail'] as $index=>$fields)
if(($local==1 && $fields['localtax1']!=0) || ($local==2 && $fields['localtax2']!=0))
{
if(($local==1 && $fields['localtax1']!=0) || ($local==2 && $fields['localtax2']!=0))
// Define type
$type=($fields['dtype']?$fields['dtype']:$fields['ptype']);
// Try to enhance type detection using date_start and date_end for free lines where type
// was not saved.
if (! empty($fields['ddate_start'])) $type=1;
if (! empty($fields['ddate_end'])) $type=1;
print '<tr class="oddeven">';
// Ref
print '<td class="nowrap left">'.$fields['link'].'</td>';
// Description
print '<td class="left">';
if ($fields['pid'])
{
// Define type
$type=($fields['dtype']?$fields['dtype']:$fields['ptype']);
// Try to enhance type detection using date_start and date_end for free lines where type
// was not saved.
if (! empty($fields['ddate_start'])) $type=1;
if (! empty($fields['ddate_end'])) $type=1;
$product_static->id=$fields['pid'];
$product_static->ref=$fields['pref'];
$product_static->type=$fields['ptype'];
print $product_static->getNomUrl(1);
if (dol_string_nohtmltag($fields['descr'])) print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16);
}
else
{
if ($type) $text = img_object($langs->trans('Service'), 'service');
else $text = img_object($langs->trans('Product'), 'product');
print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16);
// Show range
print_date_range($fields['ddate_start'], $fields['ddate_end']);
}
print '</td>';
print '<tr class="oddeven">';
// Ref
print '<td class="nowrap left">'.$fields['link'].'</td>';
// Description
print '<td class="left">';
if ($fields['pid'])
// Total HT
if ($modetax != 2)
{
print '<td class="nowrap right">';
print price($fields['totalht']);
if (price2num($fields['ftotal_ttc']))
{
$product_static->id=$fields['pid'];
$product_static->ref=$fields['pref'];
$product_static->type=$fields['ptype'];
print $product_static->getNomUrl(1);
if (dol_string_nohtmltag($fields['descr'])) print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16);
//print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - ";
$ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']);
//print ' ('.round($ratiolineinvoice*100,2).'%)';
}
print '</td>';
}
// Payment
$ratiopaymentinvoice=1;
if ($modetax != 1)
{
print '<td class="nowrap right">';
if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']);
if ($fields['payment_amount'] && $fields['ftotal_ttc'])
{
$paymentfourn_static->id=$fields['payment_id'];
print $paymentfourn_static->getNomUrl(2);
}
if ($type == 0)
{
print $langs->trans("NA");
}
else
{
if ($type) $text = img_object($langs->trans('Service'), 'service');
else $text = img_object($langs->trans('Product'), 'product');
print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16);
// Show range
print_date_range($fields['ddate_start'], $fields['ddate_end']);
print price(price2num($fields['payment_amount'], 'MT'));
if (isset($fields['payment_amount'])) {
print ' ('.round($ratiopaymentinvoice*100, 2).'%)';
}
}
print '</td>';
// Total HT
if ($modetax != 2)
{
print '<td class="nowrap right">';
print price($fields['totalht']);
if (price2num($fields['ftotal_ttc']))
{
//print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - ";
$ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']);
//print ' ('.round($ratiolineinvoice*100,2).'%)';
}
print '</td>';
}
// Payment
$ratiopaymentinvoice=1;
if ($modetax != 1)
{
print '<td class="nowrap right">';
if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']);
if ($fields['payment_amount'] && $fields['ftotal_ttc'])
{
$paymentfourn_static->id=$fields['payment_id'];
print $paymentfourn_static->getNomUrl(2);
}
if ($type == 0)
{
print $langs->trans("NA");
}
else
{
print price(price2num($fields['payment_amount'], 'MT'));
if (isset($fields['payment_amount'])) {
print ' ('.round($ratiopaymentinvoice*100, 2).'%)';
}
}
print '</td>';
}
// VAT paid
print '<td class="nowrap right">';
$temp_ht=$fields['totalht']*$ratiopaymentinvoice;
print price(price2num($temp_ht, 'MT'), 1);
print '</td>';
// Localtax
print '<td class="nowrap right">';
$temp_vat=($local==1?$fields['localtax1']:$fields['localtax2'])*$ratiopaymentinvoice;
print price(price2num($temp_vat, 'MT'), 1);
//print price($fields['vat']);
print '</td>';
print '</tr>';
$subtot_paye_total_ht += $temp_ht;
$subtot_paye_vat += $temp_vat;
$x_paye_sum += $temp_vat;
}
// VAT paid
print '<td class="nowrap right">';
$temp_ht=$fields['totalht']*$ratiopaymentinvoice;
print price(price2num($temp_ht, 'MT'), 1);
print '</td>';
// Localtax
print '<td class="nowrap right">';
$temp_vat=($local==1?$fields['localtax1']:$fields['localtax2'])*$ratiopaymentinvoice;
print price(price2num($temp_vat, 'MT'), 1);
//print price($fields['vat']);
print '</td>';
print '</tr>';
$subtot_paye_total_ht += $temp_ht;
$subtot_paye_vat += $temp_vat;
$x_paye_sum += $temp_vat;
}
}
// Total suppliers for this vat rate
print '<tr class="liste_total">';
print '<td>&nbsp;</td>';
print '<td class="right">'.$langs->trans("Total").':</td>';
if ($modetax != 1)
{
print '<td class="nowrap right">&nbsp;</td>';
print '<td class="right">&nbsp;</td>';
}
print '<td class="right">'.price(price2num($subtot_paye_total_ht, 'MT')).'</td>';
print '<td class="nowrap right">'.price(price2num($subtot_paye_vat, 'MT')).'</td>';
print '</tr>';
}
if (count($x_paye) == 0) { // Show a total line if nothing shown
print '<tr class="liste_total">';
print '<td>&nbsp;</td>';
print '<td class="right">'.$langs->trans("Total").':</td>';
if ($modetax != 1) {
print '<td class="nowrap right">&nbsp;</td>';
print '<td class="right">&nbsp;</td>';
}
print '<td class="right">'.price(price2num(0, 'MT')).'</td>';
print '<td class="nowrap right">'.price(price2num(0, 'MT')).'</td>';
print '</tr>';
}
// Total suppliers for this vat rate
print '<tr class="liste_total">';
print '<td>&nbsp;</td>';
print '<td class="right">'.$langs->trans("Total").':</td>';
if ($modetax != 1)
{
print '<td class="nowrap right">&nbsp;</td>';
print '<td class="right">&nbsp;</td>';
}
print '<td class="right">'.price(price2num($subtot_paye_total_ht, 'MT')).'</td>';
print '<td class="nowrap right">'.price(price2num($subtot_paye_vat, 'MT')).'</td>';
print '</tr>';
}
print '</table>';
//}
if (count($x_paye) == 0) { // Show a total line if nothing shown
print '<tr class="liste_total">';
print '<td>&nbsp;</td>';
print '<td class="right">'.$langs->trans("Total").':</td>';
if ($modetax != 1) {
print '<td class="nowrap right">&nbsp;</td>';
print '<td class="right">&nbsp;</td>';
}
print '<td class="right">'.price(price2num(0, 'MT')).'</td>';
print '<td class="nowrap right">'.price(price2num(0, 'MT')).'</td>';
print '</tr>';
}
print '</table>';
// Total to pay
print '<br><br>';

View File

@ -168,20 +168,20 @@ if ($action == 'create')
$charge->paiementtype=$charge->mode_reglement_id?$charge->mode_reglement_id:$charge->paiementtype;
$total = $charge->amount;
if (! empty($conf->use_javascript_ajax))
{
print "\n".'<script type="text/javascript" language="javascript">';
if (! empty($conf->use_javascript_ajax))
{
print "\n".'<script type="text/javascript" language="javascript">';
//Add js for AutoFill
print ' $(document).ready(function () {';
print ' $(".AutoFillAmount").on(\'click touchstart\', function(){
var amount = $(this).data("value");
document.getElementById($(this).data(\'rowid\')).value = amount ;
});';
print ' });'."\n";
//Add js for AutoFill
print ' $(document).ready(function () {';
print ' $(".AutoFillAmount").on(\'click touchstart\', function(){
var amount = $(this).data("value");
document.getElementById($(this).data(\'rowid\')).value = amount ;
});';
print ' });'."\n";
print ' </script>'."\n";
}
print ' </script>'."\n";
}
print load_fiche_titre($langs->trans("DoPayment"));
print "<br>\n";