--- /tmp/dsg/dolibarr/htdocs/compta/localtax/github_card.php
+++ /tmp/dsg/dolibarr/htdocs/compta/localtax/client_card.php
@@ -61,44 +61,46 @@
 

 if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))

 {

-	$db->begin();

-

-	$datev = dol_mktime(12, 0, 0, $_POST["datevmonth"], $_POST["datevday"], $_POST["datevyear"]);

-	$datep = dol_mktime(12, 0, 0, $_POST["datepmonth"], $_POST["datepday"], $_POST["datepyear"]);

-

-	$object->accountid = GETPOST("accountid");

-	$object->paymenttype = GETPOST("paiementtype");

-	$object->datev = $datev;

-	$object->datep = $datep;

-	$object->amount = price2num(GETPOST("amount"));

+    $db->begin();

+

+    $datev = dol_mktime(12, 0, 0, $_POST["datevmonth"], $_POST["datevday"], $_POST["datevyear"]);

+    $datep = dol_mktime(12, 0, 0, $_POST["datepmonth"], $_POST["datepday"], $_POST["datepyear"]);

+

+    $object->accountid = GETPOST("accountid");

+    $object->paymenttype = GETPOST("paiementtype");

+    $object->datev = $datev;

+    $object->datep = $datep;

+    $object->amount = price2num(GETPOST("amount"));

 	$object->label = GETPOST("label");

 	$object->ltt = $lttype;

 

-	$ret = $object->addPayment($user);

-	if ($ret > 0)

-	{

-		$db->commit();

-		header("Location: list.php?localTaxType=".$lttype);

-		exit;

-	} else {

-		$db->rollback();

-		setEventMessages($object->error, $object->errors, 'errors');

-		$_GET["action"] = "create";

-	}

+    $ret = $object->addPayment($user);

+    if ($ret > 0)

+    {

+        $db->commit();

+        header("Location: list.php?localTaxType=".$lttype);

+        exit;

+    }

+    else

+    {

+        $db->rollback();

+        setEventMessages($object->error, $object->errors, 'errors');

+        $_GET["action"] = "create";

+    }

 }

 

 //delete payment of localtax

 if ($action == 'delete')

 {

-	$result = $object->fetch($id);

+    $result = $object->fetch($id);

 

 	if ($object->rappro == 0)

 	{

-		$db->begin();

-

-		$ret = $object->delete($user);

-		if ($ret > 0)

-		{

+	    $db->begin();

+

+	    $ret = $object->delete($user);

+	    if ($ret > 0)

+	    {

 			if ($object->fk_bank)

 			{

 				$accountline = new AccountLine($db);

@@ -111,18 +113,24 @@
 				$db->commit();

 				header("Location: ".DOL_URL_ROOT.'/compta/localtax/list.php?localTaxType='.$object->ltt);

 				exit;

-			} else {

+			}

+			else

+			{

 				$object->error = $accountline->error;

 				$db->rollback();

 				setEventMessages($object->error, $object->errors, 'errors');

 			}

-		} else {

-			$db->rollback();

-			setEventMessages($object->error, $object->errors, 'errors');

-		}

-	} else {

-		$mesg = 'Error try do delete a line linked to a conciliated bank transaction';

-		setEventMessages($mesg, null, 'errors');

+	    }

+	    else

+	    {

+	        $db->rollback();

+	        setEventMessages($object->error, $object->errors, 'errors');

+	    }

+	}

+	else

+	{

+        $mesg = 'Error try do delete a line linked to a conciliated bank transaction';

+        setEventMessages($mesg, null, 'errors');

 	}

 }

 

@@ -149,25 +157,25 @@
 

 if ($action == 'create')

 {

-	print load_fiche_titre($langs->transcountry($lttype == 2 ? "newLT2Payment" : "newLT1Payment", $mysoc->country_code));

-

-	print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" name="formlocaltax" method="post">'."\n";

-	print '<input type="hidden" name="token" value="'.newToken().'">';

-	print '<input type="hidden" name="localTaxType" value="'.$lttype.'">';

-	print '<input type="hidden" name="action" value="add">';

-

-	print dol_get_fiche_head();

-

-	print '<table class="border centpercent">';

-

-	print "<tr>";

-	print '<td class="titlefieldcreate fieldrequired">'.$langs->trans("DatePayment").'</td><td>';

-	print $form->selectDate($datep, "datep", '', '', '', 'add', 1, 1);

-	print '</td></tr>';

-

-	print '<tr><td class="fieldrequired">'.$form->textwithpicto($langs->trans("PeriodEndDate"), $langs->trans("LastDayTaxIsRelatedTo")).'</td><td>';

-	print $form->selectDate($datev, "datev", '', '', '', 'add', 1, 1);

-	print '</td></tr>';

+    print load_fiche_titre($langs->transcountry($lttype == 2 ? "newLT2Payment" : "newLT1Payment", $mysoc->country_code));

+

+    print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" name="formlocaltax" method="post">'."\n";

+    print '<input type="hidden" name="token" value="'.newToken().'">';

+    print '<input type="hidden" name="localTaxType" value="'.$lttype.'">';

+    print '<input type="hidden" name="action" value="add">';

+

+    dol_fiche_head();

+

+    print '<table class="border centpercent">';

+

+    print "<tr>";

+    print '<td class="titlefieldcreate fieldrequired">'.$langs->trans("DatePayment").'</td><td>';

+    print $form->selectDate($datep, "datep", '', '', '', 'add', 1, 1);

+    print '</td></tr>';

+

+    print '<tr><td class="fieldrequired">'.$form->textwithpicto($langs->trans("PeriodEndDate"), $langs->trans("LastDayTaxIsRelatedTo")).'</td><td>';

+    print $form->selectDate($datev, "datev", '', '', '', 'add', 1, 1);

+    print '</td></tr>';

 

 	// Label

 	print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" class="minwidth200" value="'.($_POST["label"] ?GETPOST("label", '', 2) : $langs->transcountry(($lttype == 2 ? "LT2Payment" : "LT1Payment"), $mysoc->country_code)).'"></td></tr>';

@@ -175,38 +183,38 @@
 	// Amount

 	print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input name="amount" size="10" value="'.GETPOST("amount").'"></td></tr>';

 

-	if (!empty($conf->banque->enabled))

-	{

+    if (!empty($conf->banque->enabled))

+    {

 		print '<tr><td class="fieldrequired">'.$langs->trans("Account").'</td><td>';

-		$form->select_comptes($_POST["accountid"], "accountid", 0, "courant=1", 2); // Affiche liste des comptes courant

-		print '</td></tr>';

-

-		print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';

-		$form->select_types_paiements(GETPOST("paiementtype"), "paiementtype");

-		print "</td>\n";

-		print "</tr>";

+        $form->select_comptes($_POST["accountid"], "accountid", 0, "courant=1", 1); // Affiche liste des comptes courant

+        print '</td></tr>';

+

+	    print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';

+	    $form->select_types_paiements(GETPOST("paiementtype"), "paiementtype");

+	    print "</td>\n";

+	    print "</tr>";

 

 		// Number

 		print '<tr><td>'.$langs->trans('Numero');

 		print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';

 		print '<td><input name="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n";

-	}

-	// Other attributes

-	$parameters = array();

-	$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook

-	print $hookmanager->resPrint;

-

-	print '</table>';

-

-	print dol_get_fiche_end();

+    }

+    // Other attributes

+    $parameters = array();

+    $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook

+    print $hookmanager->resPrint;

+

+    print '</table>';

+

+	dol_fiche_end();

 

 	print '<div class="center">';

-	print '<input type="submit" class="button button-save" value="'.$langs->trans("Save").'">';

+	print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';

 	print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';

-	print '<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';

+    print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';

 	print '</div>';

 

-	print '</form>';

+    print '</form>';

 }

 

 

@@ -219,7 +227,7 @@
 	$head[$h][2] = 'card';

 	$h++;

 

-	print dol_get_fiche_head($head, 'card', $langs->transcountry("LT".$object->ltt, $mysoc->country_code), -1, 'payment');

+	dol_fiche_head($head, 'card', $langs->transcountry("LT".$object->ltt, $mysoc->country_code), -1, 'payment');

 

 	$linkback = '<a href="'.DOL_URL_ROOT.'/compta/localtax/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';

 

@@ -251,27 +259,27 @@
 		if ($object->fk_account > 0)

 		{

  		   	$bankline = new AccountLine($db);

-			$bankline->fetch($object->fk_bank);

-

-			print '<tr>';

-			print '<td>'.$langs->trans('BankTransactionLine').'</td>';

+    		$bankline->fetch($object->fk_bank);

+

+	    	print '<tr>';

+	    	print '<td>'.$langs->trans('BankTransactionLine').'</td>';

 			print '<td>';

 			print $bankline->getNomUrl(1, 0, 'showall');

-			print '</td>';

-			print '</tr>';

+	    	print '</td>';

+	    	print '</tr>';

 		}

 	}

 

-	// Other attributes

-	$parameters = array();

-	$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook

-	print $hookmanager->resPrint;

-

-	print '</table>';

-

-	print '</div>';

-

-	print dol_get_fiche_end();

+    // Other attributes

+    $parameters = array();

+    $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook

+    print $hookmanager->resPrint;

+

+    print '</table>';

+

+    print '</div>';

+

+    dol_fiche_end();

 

 

 	/*

@@ -280,8 +288,10 @@
 	print "<div class=\"tabsAction\">\n";

 	if ($object->rappro == 0)

 	{

-		print '<a class="butActionDelete" href="card.php?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans("Delete").'</a>';

-	} else {

+		print '<a class="butActionDelete" href="card.php?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a>';

+	}

+	else

+	{

 		print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("LinkedToAConcialitedTransaction").'">'.$langs->trans("Delete").'</a>';

 	}

 	print "</div>";

--- /tmp/dsg/dolibarr/htdocs/compta/localtax/github_clients.php
+++ /tmp/dsg/dolibarr/htdocs/compta/localtax/client_clients.php
@@ -50,16 +50,20 @@
 // Quarter

 if (empty($date_start) || empty($date_end)) // We define date_start and date_end

 {

-	$q = GETPOST("q");

-	if (empty($q))

-	{

-		if (GETPOST("month")) { $date_start = dol_get_first_day($year_start, GETPOST("month"), false); $date_end = dol_get_last_day($year_start, GETPOST("month"), false); } else {

+    $q = GETPOST("q");

+    if (empty($q))

+	{

+		if (GETPOST("month")) { $date_start = dol_get_first_day($year_start, GETPOST("month"), false); $date_end = dol_get_last_day($year_start, GETPOST("month"), false); }

+		else

+		{

 			$date_start = dol_get_first_day($year_start, empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START, false);

 			if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) $date_end = dol_time_plus_duree($date_start, 3, 'm') - 1;

 			elseif ($conf->global->MAIN_INFO_VAT_RETURN == 3) $date_end = dol_time_plus_duree($date_start, 1, 'y') - 1;

 			elseif ($conf->global->MAIN_INFO_VAT_RETURN == 1) $date_end = dol_time_plus_duree($date_start, 1, 'm') - 1;

 		}

-	} else {

+	}

+	else

+	{

 		if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); }

 		if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); }

 		if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); }

@@ -88,7 +92,7 @@
 }

 

 

-$calc = 0;

+

 /*

  * View

  */

@@ -119,12 +123,12 @@
 // Affiche en-tete du rapport

 if ($calc == 0 || $calc == 1)	// Calculate on invoice for goods and services

 {

-	$calcmode = $calc == 0 ? $langs->trans("CalcModeLT".$local) : $langs->trans("CalcModeLT".$local."Rec");

-	$calcmode .= ' <span class="opacitymedium">('.$langs->trans("TaxModuleSetupToModifyRulesLT", DOL_URL_ROOT.'/admin/company.php').')</span>';

-	$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);

-	if (!empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description .= '<br>'.$langs->trans("WarningDepositsNotIncluded");

-	$description .= $fsearch;

-	$description .= ' <span class="opacitymedium">('.$langs->trans("TaxModuleSetupToModifyRulesLT", DOL_URL_ROOT.'/admin/company.php').')</span>';

+    $calcmode = $calc == 0 ? $langs->trans("CalcModeLT".$local) : $langs->trans("CalcModeLT".$local."Rec");

+    $calcmode .= '<br>('.$langs->trans("TaxModuleSetupToModifyRulesLT", DOL_URL_ROOT.'/admin/company.php').')';

+    $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);

+    if (!empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description .= '<br>'.$langs->trans("WarningDepositsNotIncluded");

+    $description .= $fsearch;

+    $description .= '<br>('.$langs->trans("TaxModuleSetupToModifyRulesLT", DOL_URL_ROOT.'/admin/company.php').')';

 	$builddate = dol_now();

 

 	$elementcust = $langs->trans("CustomersInvoices");

@@ -136,13 +140,13 @@
 }

 if ($calc == 2) 	// Invoice for goods, payment for services

 {

-	$calcmode = $langs->trans("CalcModeLT2Debt");

-	$calcmode .= ' <span class="opacitymedium">('.$langs->trans("TaxModuleSetupToModifyRulesLT", DOL_URL_ROOT.'/admin/company.php').')</span>';

-	$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);

-	if (!empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description .= '<br>'.$langs->trans("WarningDepositsNotIncluded");

-	$description .= $fsearch;

-	$description .= '<span class="opacitymedium">('.$langs->trans("TaxModuleSetupToModifyRulesLT", DOL_URL_ROOT.'/admin/company.php').')</span>';

-	$builddate = dol_now();

+    $calcmode = $langs->trans("CalcModeLT2Debt");

+    $calcmode .= '<br>('.$langs->trans("TaxModuleSetupToModifyRulesLT", DOL_URL_ROOT.'/admin/company.php').')';

+    $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);

+    if (!empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description .= '<br>'.$langs->trans("WarningDepositsNotIncluded");

+    $description .= $fsearch;

+    $description .= '<br>('.$langs->trans("TaxModuleSetupToModifyRulesLT", DOL_URL_ROOT.'/admin/company.php').')';

+    $builddate = dol_now();

 

 	$elementcust = $langs->trans("CustomersInvoices");

 	$productcust = $langs->trans("Description");

@@ -157,12 +161,10 @@
 $vatcust = $langs->transcountry($local == 1 ? "LT1" : "LT2", $mysoc->country_code);

 $vatsup = $langs->transcountry($local == 1 ? "LT1" : "LT2", $mysoc->country_code);

 

-print '<div class="div-table-responsive">';

-print '<table class="noborder centpercent">';

-

 // IRPF that the customer has retained me

 if ($calc == 0 || $calc == 2)

 {

+	print '<table class="noborder centpercent">';

 	print '<tr class="liste_titre">';

 	print '<td class="left">'.$langs->trans("Num").'</td>';

 	print '<td class="left">'.$langs->trans("Customer").'</td>';

@@ -199,7 +201,9 @@
 					if ($coll->assuj == '1')

 					{

 						$intra = $langs->trans('Unknown');

-					} else {

+					}

+					else

+					{

 						$intra = '';

 					}

 				}

@@ -213,30 +217,34 @@
 				print '<td class="nowrap">'.$intra.'</td>';

 				print '<td class="nowrap right">'.price($coll->amount).'</td>';

 				print '<td class="nowrap right">'.price($local == 1 ? $coll->localtax1 : $coll->localtax2).'</td>';

-				$totalamount = $totalamount + $coll->amount;

+	            $totalamount = $totalamount + $coll->amount;

 				$total = $total + ($local == 1 ? $coll->localtax1 : $coll->localtax2);

 				print "</tr>\n";

 				$i++;

 			}

 		}

-		$x_coll_sum = $total;

+	    $x_coll_sum = $total;

 

 		print '<tr class="liste_total"><td class="right" colspan="3">'.$langs->trans("Total").':</td>';

-		print '<td class="nowrap right">'.price($totalamount).'</td>';

+	    print '<td class="nowrap right">'.price($totalamount).'</td>';

 		print '<td class="nowrap right">'.price($total).'</td>';

 		print '</tr>';

-	} else {

+	}

+	else

+	{

 		$langs->load("errors");

 		if ($coll_list == -1)

 			print '<tr><td colspan="5">'.$langs->trans("ErrorNoAccountancyModuleLoaded").'</td></tr>';

 		elseif ($coll_list == -2)

 			print '<tr><td colspan="5">'.$langs->trans("FeatureNotYetAvailable").'</td></tr>';

-		else print '<tr><td colspan="5">'.$langs->trans("Error").'</td></tr>';

+		else

+			print '<tr><td colspan="5">'.$langs->trans("Error").'</td></tr>';

 	}

 }

 

 // IRPF I retained my supplier

 if ($calc == 0 || $calc == 1) {

+	print '<table class="noborder centpercent">';

 	print '<tr class="liste_titre">';

 	print '<td class="left">'.$langs->trans("Num")."</td>";

 	print '<td class="left">'.$langs->trans("Supplier")."</td>";

@@ -266,7 +274,9 @@
 					if ($coll->assuj == '1')

 					{

 						$intra = $langs->trans('Unknown');

-					} else {

+					}

+					else

+					{

 						$intra = '';

 					}

 				}

@@ -280,42 +290,44 @@
 				print '<td class="nowrap">'.$intra."</td>";

 				print '<td class="nowrap right">'.price($coll->amount).'</td>';

 				print '<td class="nowrap right">'.price($local == 1 ? $coll->localtax1 : $coll->localtax2).'</td>';

-				$totalamount = $totalamount + $coll->amount;

+	            $totalamount = $totalamount + $coll->amount;

 				$total = $total + ($local == 1 ? $coll->localtax1 : $coll->localtax2);

 				print "</tr>\n";

 				$i++;

 			}

 		}

-		$x_paye_sum = $total;

+	    $x_paye_sum = $total;

 

 		print '<tr class="liste_total"><td class="right" colspan="3">'.$langs->trans("Total").':</td>';

-		print '<td class="nowrap right">'.price($totalamount).'</td>';

+	    print '<td class="nowrap right">'.price($totalamount).'</td>';

 		print '<td class="nowrap right">'.price($total).'</td>';

 		print '</tr>';

-	} else {

+

+		print '</table>';

+	}

+	else

+	{

 		$langs->load("errors");

 		if ($coll_list == -1)

 			print '<tr><td colspan="5">'.$langs->trans("ErrorNoAccountancyModuleLoaded").'</td></tr>';

 		elseif ($coll_list == -2)

 			print '<tr><td colspan="5">'.$langs->trans("FeatureNotYetAvailable").'</td></tr>';

-		else print '<tr><td colspan="5">'.$langs->trans("Error").'</td></tr>';

+		else

+			print '<tr><td colspan="5">'.$langs->trans("Error").'</td></tr>';

 	}

 }

 

 if ($calc == 0) {

 	// Total to pay

-	print '<tr><td colspan="5"></td></tr>';

-

+	print '<br><br>';

+	print '<table class="noborder centpercent">';

 	$diff = $x_coll_sum - $x_paye_sum;

 	print '<tr class="liste_total">';

 	print '<td class="liste_total" colspan="4">'.$langs->trans("TotalToPay").($q ? ', '.$langs->trans("Quadri").' '.$q : '').'</td>';

 	print '<td class="liste_total nowrap right"><b>'.price(price2num($diff, 'MT'))."</b></td>\n";

 	print "</tr>\n";

 }

-

 print '</table>';

-print '</div>';

-

 

 // End of page

 llxFooter();

--- /tmp/dsg/dolibarr/htdocs/compta/localtax/github_index.php
+++ /tmp/dsg/dolibarr/htdocs/compta/localtax/client_index.php
@@ -52,11 +52,15 @@
 	$q = GETPOST("q", "int");

 	if (empty($q))

 	{

-		if (GETPOST("month", "int")) { $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); } else {

+		if (GETPOST("month", "int")) { $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); }

+		else

+		{

 			$date_start = dol_get_first_day($year_start, $conf->global->SOCIETE_FISCAL_MONTH_START, false);

 			$date_end = dol_time_plus_duree($date_start, 1, 'y') - 1;

 		}

-	} else {

+	}

+	else

+	{

 		if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); }

 		if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); }

 		if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); }

@@ -86,99 +90,102 @@
  */

 function pt($db, $sql, $date)

 {

-	global $conf, $bc, $langs;

-

-	$result = $db->query($sql);

-	if ($result) {

-		$num = $db->num_rows($result);

-		$i = 0;

-		$total = 0;

-		print '<table class="noborder centpercent">';

-

-		print '<tr class="liste_titre">';

-		print '<td class="nowrap">'.$date.'</td>';

-		print '<td class="right">'.$langs->trans("ClaimedForThisPeriod").'</td>';

-		print '<td class="right">'.$langs->trans("PaidDuringThisPeriod").'</td>';

-		print "</tr>\n";

-

-		$totalclaimed = 0;

-		$totalpaid = 0;

-		$amountclaimed = 0;

-		$amountpaid = 0;

-		$previousmonth = '';

-		$previousmode = '';

-		$mode = '';

-

-		while ($i < $num) {

-			$obj = $db->fetch_object($result);

-			$mode = $obj->mode;

-

-			//print $obj->dm.' '.$obj->mode.' '.$previousmonth.' '.$previousmode;

-			if ($obj->mode == 'claimed' && !empty($previousmode))

-			{

-				print '<tr class="oddeven">';

-				print '<td class="nowrap">'.$previousmonth."</td>\n";

-				print '<td class="nowrap right">'.price($amountclaimed)."</td>\n";

-				print '<td class="nowrap right">'.price($amountpaid)."</td>\n";

-				print "</tr>\n";

-

-				$amountclaimed = 0;

-				$amountpaid = 0;

-			}

-

-			if ($obj->mode == 'claimed')

-			{

-				$amountclaimed = $obj->mm;

-				$totalclaimed = $totalclaimed + $amountclaimed;

-			}

-			if ($obj->mode == 'paid')

-			{

-				$amountpaid = $obj->mm;

-				$totalpaid = $totalpaid + $amountpaid;

-			}

-

-			if ($obj->mode == 'paid')

-			{

-				print '<tr class="oddeven">';

-				print '<td class="nowrap">'.$obj->dm."</td>\n";

-				print '<td class="nowrap right">'.price($amountclaimed)."</td>\n";

-				print '<td class="nowrap right">'.price($amountpaid)."</td>\n";

-				print "</tr>\n";

-				$amountclaimed = 0;

-				$amountpaid = 0;

-				$previousmode = '';

-				$previousmonth = '';

-			} else {

-				$previousmode = $obj->mode;

-				$previousmonth = $obj->dm;

-			}

-

-			$i++;

-		}

-

-		if ($mode == 'claimed' && !empty($previousmode))

-		{

-			print '<tr class="oddeven">';

-			print '<td class="nowrap">'.$previousmonth."</td>\n";

-			print '<td class="nowrap right">'.price($amountclaimed)."</td>\n";

-			print '<td class="nowrap right">'.price($amountpaid)."</td>\n";

-			print "</tr>\n";

-

-			$amountclaimed = 0;

-			$amountpaid = 0;

-		}

-

-		print '<tr class="liste_total">';

-		print '<td class="right">'.$langs->trans("Total").'</td>';

-		print '<td class="nowrap right">'.price($totalclaimed).'</td>';

-		print '<td class="nowrap right">'.price($totalpaid).'</td>';

-		print "</tr>";

-

-		print "</table>";

-		$db->free($result);

-	} else {

-		dol_print_error($db);

-	}

+    global $conf, $bc, $langs;

+

+    $result = $db->query($sql);

+    if ($result) {

+        $num = $db->num_rows($result);

+        $i = 0;

+        $total = 0;

+        print '<table class="noborder centpercent">';

+

+        print '<tr class="liste_titre">';

+        print '<td class="nowrap">'.$date.'</td>';

+        print '<td class="right">'.$langs->trans("ClaimedForThisPeriod").'</td>';

+        print '<td class="right">'.$langs->trans("PaidDuringThisPeriod").'</td>';

+        print "</tr>\n";

+

+        $totalclaimed = 0;

+        $totalpaid = 0;

+        $amountclaimed = 0;

+        $amountpaid = 0;

+        $previousmonth = '';

+        $previousmode = '';

+        $mode = '';

+

+        while ($i < $num) {

+            $obj = $db->fetch_object($result);

+            $mode = $obj->mode;

+

+            //print $obj->dm.' '.$obj->mode.' '.$previousmonth.' '.$previousmode;

+            if ($obj->mode == 'claimed' && !empty($previousmode))

+            {

+            	print '<tr class="oddeven">';

+            	print '<td class="nowrap">'.$previousmonth."</td>\n";

+            	print '<td class="nowrap right">'.price($amountclaimed)."</td>\n";

+            	print '<td class="nowrap right">'.price($amountpaid)."</td>\n";

+            	print "</tr>\n";

+

+            	$amountclaimed = 0;

+            	$amountpaid = 0;

+            }

+

+            if ($obj->mode == 'claimed')

+            {

+            	$amountclaimed = $obj->mm;

+            	$totalclaimed = $totalclaimed + $amountclaimed;

+            }

+            if ($obj->mode == 'paid')

+            {

+            	$amountpaid = $obj->mm;

+            	$totalpaid = $totalpaid + $amountpaid;

+            }

+

+            if ($obj->mode == 'paid')

+            {

+            	print '<tr class="oddeven">';

+            	print '<td class="nowrap">'.$obj->dm."</td>\n";

+            	print '<td class="nowrap right">'.price($amountclaimed)."</td>\n";

+            	print '<td class="nowrap right">'.price($amountpaid)."</td>\n";

+            	print "</tr>\n";

+            	$amountclaimed = 0;

+            	$amountpaid = 0;

+            	$previousmode = '';

+            	$previousmonth = '';

+            }

+            else

+            {

+            	$previousmode = $obj->mode;

+            	$previousmonth = $obj->dm;

+            }

+

+            $i++;

+        }

+

+        if ($mode == 'claimed' && !empty($previousmode))

+        {

+        	print '<tr class="oddeven">';

+        	print '<td class="nowrap">'.$previousmonth."</td>\n";

+        	print '<td class="nowrap right">'.price($amountclaimed)."</td>\n";

+        	print '<td class="nowrap right">'.price($amountpaid)."</td>\n";

+        	print "</tr>\n";

+

+        	$amountclaimed = 0;

+        	$amountpaid = 0;

+        }

+

+        print '<tr class="liste_total">';

+        print '<td class="right">'.$langs->trans("Total").'</td>';

+        print '<td class="nowrap right">'.price($totalclaimed).'</td>';

+        print '<td class="nowrap right">'.price($totalpaid).'</td>';

+        print "</tr>";

+

+        print "</table>";

+        $db->free($result);

+    }

+    else {

+        dol_print_error($db);

+    }

 }

 

 if (empty($localTaxType))

@@ -227,10 +234,10 @@
 $description = $fsearch;

 

 // Show report header

-$name = $langs->transcountry($localTaxType == 1 ? "LT1ReportByMonth" : "LT2ReportByMonth", $mysoc->country_code);

+$name = $langs->trans("ReportByMonth");

 $description .= $langs->trans($LT);

 $calcmode = $langs->trans("LTReportBuildWithOptionDefinedInModule").' ';

-$calcmode .= ' <span class="opacitymedium">('.$langs->trans("TaxModuleSetupToModifyRulesLT", DOL_URL_ROOT.'/admin/company.php').')</span>';

+$calcmode .= '('.$langs->trans("TaxModuleSetupToModifyRulesLT", DOL_URL_ROOT.'/admin/company.php').')<br>';

 

 //if (! empty($conf->global->MAIN_MODULE_ACCOUNTING)) $description.='<br>'.$langs->trans("ThisIsAnEstimatedValue");

 

@@ -259,14 +266,14 @@
 print '<tr class="liste_titre">';

 print '<td width="30%">'.$langs->trans("Year")." ".$y."</td>";

 if ($CalcLT == 0) {

-	print '<td class="right">'.$langs->transcountry($LTCustomer, $mysoc->country_code).'</td>';

-	print '<td class="right">'.$langs->transcountry($LTSupplier, $mysoc->country_code).'</td>';

+    print '<td class="right">'.$langs->transcountry($LTCustomer, $mysoc->country_code).'</td>';

+    print '<td class="right">'.$langs->transcountry($LTSupplier, $mysoc->country_code).'</td>';

 }

 if ($CalcLT == 1) {

-	print '<td class="right">'.$langs->transcountry($LTSupplier, $mysoc->country_code).'</td><td></td>';

+    print '<td class="right">'.$langs->transcountry($LTSupplier, $mysoc->country_code).'</td><td></td>';

 }

 if ($CalcLT == 2) {

-	print '<td class="right">'.$langs->transcountry($LTCustomer, $mysoc->country_code).'</td><td></td>';

+    print '<td class="right">'.$langs->transcountry($LTCustomer, $mysoc->country_code).'</td><td></td>';

 }

 print '<td class="right">'.$langs->trans("TotalToPay").'</td>';

 print "<td>&nbsp;</td>\n";

@@ -381,7 +388,9 @@
 				'localtax2'			=>$x_paye[$my_paye_rate]['localtax2_list'][$id],

 				//'link'				=>$expensereport->getNomUrl(1)

 				);

-			} else {

+			}

+			else

+			{

 				//$invoice_supplier->id=$x_paye[$my_paye_rate]['facid'][$id];

 				//$invoice_supplier->ref=$x_paye[$my_paye_rate]['facnum'][$id];

 				//$invoice_supplier->type=$x_paye[$my_paye_rate]['type'][$id];

@@ -414,144 +423,144 @@
 	}

 	//now we have an array (x_both) indexed by rates for coll and paye

 

-	$action = "tva";

-	$object = array(&$x_coll, &$x_paye, &$x_both);

-	$parameters["mode"] = $modetax;

-	$parameters["year"] = $y;

-	$parameters["month"] = $m;

-	$parameters["type"] = 'localtax'.$localTaxType;

-

-	// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array

-	$hookmanager->initHooks(array('externalbalance'));

-	$reshook = $hookmanager->executeHooks('addVatLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks

-

-	if (!is_array($x_coll) && $coll_listbuy == -1)

-	{

-		$langs->load("errors");

-		print '<tr><td colspan="5">'.$langs->trans("ErrorNoAccountancyModuleLoaded").'</td></tr>';

-		break;

-	}

-	if (!is_array($x_paye) && $coll_listbuy == -2)

-	{

-		print '<tr><td colspan="5">'.$langs->trans("FeatureNotYetAvailable").'</td></tr>';

-		break;

-	}

-

-

-	print '<tr class="oddeven">';

-	print '<td class="nowrap"><a href="'.DOL_URL_ROOT.'/compta/localtax/quadri_detail.php?leftmenu=tax_vat&month='.$m.'&year='.$y.'">'.dol_print_date(dol_mktime(0, 0, 0, $m, 1, $y), "%b %Y").'</a></td>';

-

-	$x_coll_sum = 0;

-	foreach (array_keys($x_coll) as $rate)

-	{

-		$subtot_coll_total_ht = 0;

-		$subtot_coll_vat = 0;

-

-		foreach ($x_both[$rate]['coll']['detail'] as $index => $fields)

-		{

-			// Payment

-			$ratiopaymentinvoice = 1;

-			if ($modetax != 1)

-			{

-				// Define type

-				// We MUST use dtype (type in line). We can use something else, only if dtype is really unknown.

-				$type = (isset($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;

-				}

-

-				if (($type == 0 && $conf->global->TAX_MODE_SELL_PRODUCT == 'invoice')

-					|| ($type == 1 && $conf->global->TAX_MODE_SELL_SERVICE == 'invoice'))

-				{

-					//print $langs->trans("NA");

-				} else {

-					if (isset($fields['payment_amount']) && price2num($fields['ftotal_ttc'])) {

-						$ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']);

-					}

-				}

-			}

-			//var_dump('type='.$type.' '.$fields['totalht'].' '.$ratiopaymentinvoice);

-			$temp_ht = $fields['totalht'] * $ratiopaymentinvoice;

-			$temp_vat = $fields['localtax'.$localTaxType] * $ratiopaymentinvoice;

-			$subtot_coll_total_ht += $temp_ht;

-			$subtot_coll_vat      += $temp_vat;

-			$x_coll_sum           += $temp_vat;

-		}

-	}

-	print '<td class="nowrap right">'.price(price2num($x_coll_sum, 'MT')).'</td>';

-

-	$x_paye_sum = 0;

-	foreach (array_keys($x_paye) as $rate)

-	{

-		$subtot_paye_total_ht = 0;

-		$subtot_paye_vat = 0;

-

-		foreach ($x_both[$rate]['paye']['detail'] as $index => $fields)

-		{

-			// Payment

-			$ratiopaymentinvoice = 1;

-			if ($modetax != 1)

-			{

-				// Define type

-				// We MUST use dtype (type in line). We can use something else, only if dtype is really unknown.

-				$type = (isset($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;

-				}

-

-				if (($type == 0 && $conf->global->TAX_MODE_SELL_PRODUCT == 'invoice')

-					|| ($type == 1 && $conf->global->TAX_MODE_SELL_SERVICE == 'invoice'))

-				{

-					//print $langs->trans("NA");

-				} else {

-					if (isset($fields['payment_amount']) && price2num($fields['ftotal_ttc'])) {

-						$ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']);

-					}

-				}

-			}

-			//var_dump('type='.$type.' '.$fields['totalht'].' '.$ratiopaymentinvoice);

-			$temp_ht = $fields['totalht'] * $ratiopaymentinvoice;

-			$temp_vat = $fields['localtax'.$localTaxType] * $ratiopaymentinvoice;

-			$subtot_paye_total_ht += $temp_ht;

-			$subtot_paye_vat      += $temp_vat;

-			$x_paye_sum           += $temp_vat;

-		}

-	}

-	print '<td class="nowrap right">'.price(price2num($x_paye_sum, 'MT')).'</td>';

-

-	$subtotalcoll = $subtotalcoll + $x_coll_sum;

-	$subtotalpaye = $subtotalpaye + $x_paye_sum;

-

-	$diff = $x_coll_sum - $x_paye_sum;

-	$total = $total + $diff;

-	$subtotal = price2num($subtotal + $diff, 'MT');

-

-	print '<td class="nowrap right">'.price(price2num($diff, 'MT')).'</td>'."\n";

-	print "<td>&nbsp;</td>\n";

-	print "</tr>\n";

-

-	$i++; $m++;

-	if ($i > 2)

-	{

-		print '<tr class="liste_total">';

-		print '<td class="right"><a href="quadri_detail.php?leftmenu=tax_vat&q='.round($m / 3).'&year='.$y.'">'.$langs->trans("SubTotal").'</a>:</td>';

-		print '<td class="nowrap right">'.price(price2num($subtotalcoll, 'MT')).'</td>';

-		print '<td class="nowrap right">'.price(price2num($subtotalpaye, 'MT')).'</td>';

-		print '<td class="nowrap right">'.price(price2num($subtotal, 'MT')).'</td>';

-		print '<td>&nbsp;</td></tr>';

-		$i = 0;

-		$subtotalcoll = 0; $subtotalpaye = 0; $subtotal = 0;

-	}

+    $action = "tva";

+    $object = array(&$x_coll, &$x_paye, &$x_both);

+    $parameters["mode"] = $modetax;

+    $parameters["year"] = $y;

+    $parameters["month"] = $m;

+    $parameters["type"] = 'localtax'.$localTaxType;

+

+    // Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array

+    $hookmanager->initHooks(array('externalbalance'));

+    $reshook = $hookmanager->executeHooks('addVatLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks

+

+    if (!is_array($x_coll) && $coll_listbuy == -1)

+    {

+        $langs->load("errors");

+        print '<tr><td colspan="5">'.$langs->trans("ErrorNoAccountancyModuleLoaded").'</td></tr>';

+        break;

+    }

+    if (!is_array($x_paye) && $coll_listbuy == -2)

+    {

+        print '<tr><td colspan="5">'.$langs->trans("FeatureNotYetAvailable").'</td></tr>';

+        break;

+    }

+

+

+    print '<tr class="oddeven">';

+    print '<td class="nowrap"><a href="'.DOL_URL_ROOT.'/compta/localtax/quadri_detail.php?leftmenu=tax_vat&month='.$m.'&year='.$y.'">'.dol_print_date(dol_mktime(0, 0, 0, $m, 1, $y), "%b %Y").'</a></td>';

+

+    $x_coll_sum = 0;

+    foreach (array_keys($x_coll) as $rate)

+    {

+    	$subtot_coll_total_ht = 0;

+    	$subtot_coll_vat = 0;

+

+    	foreach ($x_both[$rate]['coll']['detail'] as $index => $fields)

+    	{

+    		// Payment

+    		$ratiopaymentinvoice = 1;

+    		if ($modetax != 1)

+    		{

+    			// Define type

+    			// We MUST use dtype (type in line). We can use something else, only if dtype is really unknown.

+    			$type = (isset($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;

+    			}

+

+    			if (($type == 0 && $conf->global->TAX_MODE_SELL_PRODUCT == 'invoice')

+    				|| ($type == 1 && $conf->global->TAX_MODE_SELL_SERVICE == 'invoice'))

+    			{

+    				//print $langs->trans("NA");

+    			} else {

+    				if (isset($fields['payment_amount']) && price2num($fields['ftotal_ttc'])) {

+    					$ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']);

+    				}

+    			}

+    		}

+    		//var_dump('type='.$type.' '.$fields['totalht'].' '.$ratiopaymentinvoice);

+    		$temp_ht = $fields['totalht'] * $ratiopaymentinvoice;

+    		$temp_vat = $fields['localtax'.$localTaxType] * $ratiopaymentinvoice;

+    		$subtot_coll_total_ht += $temp_ht;

+    		$subtot_coll_vat      += $temp_vat;

+    		$x_coll_sum           += $temp_vat;

+    	}

+    }

+    print '<td class="nowrap right">'.price(price2num($x_coll_sum, 'MT')).'</td>';

+

+    $x_paye_sum = 0;

+    foreach (array_keys($x_paye) as $rate)

+    {

+    	$subtot_paye_total_ht = 0;

+    	$subtot_paye_vat = 0;

+

+    	foreach ($x_both[$rate]['paye']['detail'] as $index => $fields)

+    	{

+    		// Payment

+    		$ratiopaymentinvoice = 1;

+    		if ($modetax != 1)

+    		{

+    			// Define type

+    			// We MUST use dtype (type in line). We can use something else, only if dtype is really unknown.

+    			$type = (isset($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;

+    			}

+

+    			if (($type == 0 && $conf->global->TAX_MODE_SELL_PRODUCT == 'invoice')

+    				|| ($type == 1 && $conf->global->TAX_MODE_SELL_SERVICE == 'invoice'))

+    			{

+    				//print $langs->trans("NA");

+    			} else {

+    				if (isset($fields['payment_amount']) && price2num($fields['ftotal_ttc'])) {

+    					$ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']);

+    				}

+    			}

+    		}

+    		//var_dump('type='.$type.' '.$fields['totalht'].' '.$ratiopaymentinvoice);

+    		$temp_ht = $fields['totalht'] * $ratiopaymentinvoice;

+    		$temp_vat = $fields['localtax'.$localTaxType] * $ratiopaymentinvoice;

+    		$subtot_paye_total_ht += $temp_ht;

+    		$subtot_paye_vat      += $temp_vat;

+    		$x_paye_sum           += $temp_vat;

+    	}

+    }

+    print '<td class="nowrap right">'.price(price2num($x_paye_sum, 'MT')).'</td>';

+

+    $subtotalcoll = $subtotalcoll + $x_coll_sum;

+    $subtotalpaye = $subtotalpaye + $x_paye_sum;

+

+    $diff = $x_coll_sum - $x_paye_sum;

+    $total = $total + $diff;

+    $subtotal = price2num($subtotal + $diff, 'MT');

+

+    print '<td class="nowrap right">'.price(price2num($diff, 'MT')).'</td>'."\n";

+    print "<td>&nbsp;</td>\n";

+    print "</tr>\n";

+

+    $i++; $m++;

+    if ($i > 2)

+    {

+    	print '<tr class="liste_total">';

+    	print '<td class="right"><a href="quadri_detail.php?leftmenu=tax_vat&q='.round($m / 3).'&year='.$y.'">'.$langs->trans("SubTotal").'</a>:</td>';

+    	print '<td class="nowrap right">'.price(price2num($subtotalcoll, 'MT')).'</td>';

+    	print '<td class="nowrap right">'.price(price2num($subtotalpaye, 'MT')).'</td>';

+    	print '<td class="nowrap right">'.price(price2num($subtotal, 'MT')).'</td>';

+    	print '<td>&nbsp;</td></tr>';

+    	$i = 0;

+    	$subtotalcoll = 0; $subtotalpaye = 0; $subtotal = 0;

+    }

 }

 print '<tr class="liste_total"><td class="right" colspan="3">'.$langs->trans("TotalToPay").':</td><td class="nowrap right">'.price(price2num($total, 'MT')).'</td>';

 print "<td>&nbsp;</td>\n";

@@ -565,7 +574,7 @@
 

 

 /*

- * Paid

+ * Payed

  */

 

 print load_fiche_titre($langs->transcountry($LTPaid, $mysoc->country_code), '', '');

--- /tmp/dsg/dolibarr/htdocs/compta/localtax/github_list.php
+++ /tmp/dsg/dolibarr/htdocs/compta/localtax/client_list.php
@@ -31,7 +31,7 @@
 $socid = GETPOST('socid', 'int');

 if ($user->socid) $socid = $user->socid;

 $result = restrictedArea($user, 'tax', '', '', 'charges');

-$ltt = GETPOST("localTaxType", 'int');

+$ltt = GETPOST("localTaxType");

 

 

 /*

@@ -42,59 +42,63 @@
 

 $localtax_static = new Localtax($db);

 

-$url = DOL_URL_ROOT.'/compta/localtax/card.php?action=create&localTaxType='.$ltt;

-if (!empty($socid)) $url .= '&socid='.$socid;

-$newcardbutton = dolGetButtonTitle($langs->trans('NewLocalTaxPayment', ($ltt + 1)), '', 'fa fa-plus-circle', $url, '', $user->rights->tax->charges->creer);

+$newcardbutton = '';

+if ($user->rights->tax->charges->creer)

+{

+    $newcardbutton .= dolGetButtonTitle($langs->trans('NewLocalTaxPayment', ($ltt + 1)), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/localtax/card.php?action=create&localTaxType='.$ltt);

+}

 

 print load_fiche_titre($langs->transcountry($ltt == 2 ? "LT2Payments" : "LT1Payments", $mysoc->country_code), $newcardbutton, 'title_accountancy');

 

 $sql = "SELECT rowid, amount, label, f.datev, f.datep";

 $sql .= " FROM ".MAIN_DB_PREFIX."localtax as f ";

-$sql .= " WHERE f.entity = ".$conf->entity." AND localtaxtype = ".$db->escape($ltt);

+$sql .= " WHERE f.entity = ".$conf->entity." AND localtaxtype=".$db->escape($ltt);

 $sql .= " ORDER BY datev DESC";

 

 $result = $db->query($sql);

 if ($result)

 {

-	$num = $db->num_rows($result);

-	$i = 0;

-	$total = 0;

+    $num = $db->num_rows($result);

+    $i = 0;

+    $total = 0;

 

-	print '<table class="noborder centpercent">';

-	print '<tr class="liste_titre">';

-	print '<td class="nowrap" align="left">'.$langs->trans("Ref").'</td>';

-	print "<td>".$langs->trans("Label")."</td>";

-	print "<td>".$langs->trans("PeriodEndDate")."</td>";

-	print '<td class="nowrap" align="left">'.$langs->trans("DatePayment").'</td>';

-	print "<td align=\"right\">".$langs->trans("PayedByThisPayment")."</td>";

-	print "</tr>\n";

-	$var = 1;

-	while ($i < $num)

-	{

-		$obj = $db->fetch_object($result);

+    print '<table class="noborder centpercent">';

+    print '<tr class="liste_titre">';

+    print '<td class="nowrap" align="left">'.$langs->trans("Ref").'</td>';

+    print "<td>".$langs->trans("Label")."</td>";

+    print "<td>".$langs->trans("PeriodEndDate")."</td>";

+    print '<td class="nowrap" align="left">'.$langs->trans("DatePayment").'</td>';

+    print "<td align=\"right\">".$langs->trans("PayedByThisPayment")."</td>";

+    print "</tr>\n";

+    $var = 1;

+    while ($i < $num)

+    {

+        $obj = $db->fetch_object($result);

 

-		print '<tr class="oddeven">';

+        print '<tr class="oddeven">';

 

 		$localtax_static->id = $obj->rowid;

 		$localtax_static->ref = $obj->rowid;

 		print "<td>".$localtax_static->getNomUrl(1)."</td>\n";

-		print "<td>".dol_trunc($obj->label, 40)."</td>\n";

-		print '<td class="left">'.dol_print_date($db->jdate($obj->datev), 'day')."</td>\n";

-		print '<td class="left">'.dol_print_date($db->jdate($obj->datep), 'day')."</td>\n";

-		$total = $total + $obj->amount;

+        print "<td>".dol_trunc($obj->label, 40)."</td>\n";

+        print '<td class="left">'.dol_print_date($db->jdate($obj->datev), 'day')."</td>\n";

+        print '<td class="left">'.dol_print_date($db->jdate($obj->datep), 'day')."</td>\n";

+        $total = $total + $obj->amount;

 

-		print "<td align=\"right\">".price($obj->amount)."</td>";

-		print "</tr>\n";

+        print "<td align=\"right\">".price($obj->amount)."</td>";

+        print "</tr>\n";

 

-		$i++;

-	}

-	print '<tr class="liste_total"><td colspan="4">'.$langs->trans("Total").'</td>';

-	print '<td class="right">'.price($total).'</td></tr>';

+        $i++;

+    }

+    print '<tr class="liste_total"><td colspan="4">'.$langs->trans("Total").'</td>';

+    print '<td class="right">'.price($total).'</td></tr>';

 

-	print "</table>";

-	$db->free($result);

-} else {

-	dol_print_error($db);

+    print "</table>";

+    $db->free($result);

+}

+else

+{

+    dol_print_error($db);

 }

 

 // End of page

--- /tmp/dsg/dolibarr/htdocs/compta/localtax/github_quadri_detail.php
+++ /tmp/dsg/dolibarr/htdocs/compta/localtax/client_quadri_detail.php
@@ -63,13 +63,17 @@
 	$q = GETPOST("q", "int");

 	if (empty($q))

 	{

-		if (GETPOST("month", "int")) { $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); } else {

+		if (GETPOST("month", "int")) { $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); }

+		else

+		{

 			$date_start = dol_get_first_day($year_start, empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START, false);

 			if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) $date_end = dol_time_plus_duree($date_start, 3, 'm') - 1;

 			elseif ($conf->global->MAIN_INFO_VAT_RETURN == 3) $date_end = dol_time_plus_duree($date_start, 1, 'y') - 1;

 			elseif ($conf->global->MAIN_INFO_VAT_RETURN == 1) $date_end = dol_time_plus_duree($date_start, 1, 'm') - 1;

 		}

-	} else {

+	}

+	else

+	{

 		if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); }

 		if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); }

 		if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); }

@@ -134,7 +138,7 @@
 if ($modetax == 0) $calcmode = $langs->trans('OptionVATDefault');

 if ($modetax == 1) $calcmode = $langs->trans('OptionVATDebitOption');

 if ($modetax == 2) $calcmode = $langs->trans('OptionPaymentForProductAndServices');

-$calcmode .= ' <span class="opacitymedium">('.$langs->trans("TaxModuleSetupToModifyRules", DOL_URL_ROOT.'/admin/taxes.php').')</span>';

+$calcmode .= '<br>('.$langs->trans("TaxModuleSetupToModifyRules", DOL_URL_ROOT.'/admin/taxes.php').')';

 // Set period

 $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);

 $prevyear = $year_start;

@@ -142,16 +146,16 @@
 if ($prevquarter > 1) {

 	$prevquarter--;

 } else {

-	$prevquarter = 4;

-	$prevyear--;

+    $prevquarter = 4;

+    $prevyear--;

 }

 $nextyear = $year_start;

 $nextquarter = $q;

 if ($nextquarter < 4) {

 	$nextquarter++;

 } else {

-	$nextquarter = 1;

-	$nextyear++;

+    $nextquarter = 1;

+    $nextyear++;

 }

 $description .= $fsearch;

 $builddate = dol_now();

@@ -200,13 +204,12 @@
 }

 

 // VAT Received and paid

-print '<div class="div-table-responsive">';

 echo '<table class="noborder centpercent">';

 

 $y = $year_current;

 $total = 0;

 $i = 0;

-$columns = 4;

+$columns = 5;

 

 // Load arrays of datas

 $x_coll = tax_by_rate('localtax'.$local, $db, 0, 0, $date_start, $date_end, $modetax, 'sell');

@@ -219,8 +222,11 @@
 		print '<tr><td colspan="'.$columns.'">'.$langs->trans("ErrorNoAccountancyModuleLoaded").'</td></tr>';

 	elseif ($x_coll == -2)

 		print '<tr><td colspan="'.$columns.'">'.$langs->trans("FeatureNotYetAvailable").'</td></tr>';

-	else print '<tr><td colspan="'.$columns.'">'.$langs->trans("Error").'</td></tr>';

-} else {

+	else

+		print '<tr><td colspan="'.$columns.'">'.$langs->trans("Error").'</td></tr>';

+}

+else

+{

 	$x_both = array();

 

 	//now, from these two arrays, get another array with one rate per line

@@ -311,9 +317,8 @@
 	$x_paye_sum = 0;

 	$x_paye_ht = 0;

 

-	$span = $columns - 1;

-	if ($modetax != 2) $span += 1;

-	if ($modetax != 1) $span += 1;

+	$span = $columns;

+	if ($modetax != 1) $span += 2;

 

 	// Customers invoices

 	print '<tr class="liste_titre">';

@@ -367,15 +372,17 @@
 						$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 {

+					}

+					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]);

-						}

+			            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

@@ -409,7 +416,8 @@
 						if ($type == 0)

 						{

 							print $langs->trans("NotUsedForGoods");

-						} else {

+						}

+						else {

 							print price($fields['payment_amount']);

 							if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice * 100, 2).'%)';

 						}

@@ -438,41 +446,41 @@
 			}

 		}

 

-		// 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

-	{

-		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>';

-	}

-

-	// Blank line

+	    // 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

+    {

+        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>';

+    }

+

+    // Blank line

 	print '<tr><td colspan="'.($span + 1).'">&nbsp;</td></tr>';

-	//print '</table>';

+	print '</table>';

 	$diff = $x_coll_sum;

 

-	//echo '<table class="noborder centpercent">';

+	echo '<table class="noborder centpercent">';

 	//print table headers for this quadri - expenses now

 	print '<tr class="liste_titre">';

 	print '<td class="left">'.$elementsup.'</td>';

@@ -524,7 +532,9 @@
 						$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 {

+					}

+					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);

@@ -562,7 +572,9 @@
 						if ($type == 0)

 						{

 							print $langs->trans("NA");

-						} else {

+						}

+						else

+						{

 							print price(price2num($fields['payment_amount'], 'MT'));

 							if (isset($fields['payment_amount'])) {

 								print ' ('.round($ratiopaymentinvoice * 100, 2).'%)';

@@ -592,18 +604,18 @@
 			}

 		}

 

-		// 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>';

+	    // 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

@@ -619,8 +631,12 @@
 		print '</tr>';

 	}

 

+	print '</table>';

+

 	// Total to pay

-	$diff = $x_coll_sum - $x_paye_sum;

+    print '<br><br>';

+    print '<table class="noborder centpercent">';

+    $diff = $x_coll_sum - $x_paye_sum;

 	print '<tr class="liste_total">';

 	print '<td class="liste_total" colspan="'.$span.'">'.$langs->trans("TotalToPay").($q ? ', '.$langs->trans("Quadri").' '.$q : '').'</td>';

 	print '<td class="liste_total nowrap right"><b>'.price(price2num($diff, 'MT'))."</b></td>\n";

@@ -628,9 +644,7 @@
 

 	$i++;

 }

-

 print '</table>';

-print '</div>';

 

 // End of page

 llxFooter();