diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php index 13c5aa77226..fea0d14f3c2 100644 --- a/htdocs/compta/tva/clients.php +++ b/htdocs/compta/tva/clients.php @@ -23,7 +23,7 @@ * \file htdocs/compta/tva/clients.php * \ingroup tax * \brief Page des societes - * \version $Id: clients.php,v 1.31 2011/07/18 11:11:19 eldy Exp $ + * \version $Id$ */ require('../../main.inc.php'); @@ -38,7 +38,7 @@ $langs->load("companies"); $langs->load("products"); // Date range -$year=GETPOST("year"); +$year=$_REQUEST["year"]; if (empty($year)) { $year_current = strftime("%Y",dol_now()); @@ -52,26 +52,24 @@ $date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday" // Quarter if (empty($date_start) || empty($date_end)) // We define date_start and date_end { - $q=GETPOST("q"); - if (empty($q)) + $q=(! empty($_REQUEST["q"]))?$_REQUEST["q"]:0; + if ($q==0) { if (isset($_REQUEST["month"])) { $date_start=dol_get_first_day($year_start,$_REQUEST["month"],false); $date_end=dol_get_last_day($year_start,$_REQUEST["month"],false); } - else - { - $month_current = strftime("%m",dol_now()); - if ($month_current >= 10) $q=4; - elseif ($month_current >= 7) $q=3; - elseif ($month_current >= 4) $q=2; - else $q=1; - } + else $q=1; } 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); } if ($q==4) { $date_start=dol_get_first_day($year_start,10,false); $date_end=dol_get_last_day($year_start,12,false); } } +else +{ + // TODO We define q -$min = GETPOST("min"); +} + +$min = $_REQUEST["min"]; if (empty($min)) $min = 0; // Define modetax (0 or 1) @@ -80,7 +78,7 @@ $modetax = $conf->global->TAX_MODE; if (isset($_REQUEST["modetax"])) $modetax=$_REQUEST["modetax"]; // Security check -$socid = GETPOST("socid"); +$socid = isset($_REQUEST["socid"])?$_REQUEST["socid"]:''; if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'tax', '', '', 'charges'); @@ -106,7 +104,7 @@ $fsearch.='
'; $fsearch.=' '; $fsearch.=' '; $fsearch.=' '.$langs->trans("SalesTurnover").' '.$langs->trans("Minimum").': '; -$fsearch.=' '; +$fsearch.=' '; // Affiche en-tete du rapport if ($modetax==1) // Calculate on invoice for goods and services @@ -117,8 +115,7 @@ if ($modetax==1) // Calculate on invoice for goods and services //$periodlink=($year_start?"".img_previous()." ".img_next()."":""); $description=$langs->trans("RulesVATDue"); //if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='
'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite'); - if ($conf->global->MAIN_MODULE_COMPTABILITE) $description.='
'.$langs->trans("WarningDepositsNotIncluded"); - $description.=$fsearch; + $description.=$fsearch; $description.='
('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')'; $builddate=time(); //$exportlink=$langs->trans("NotYetAvailable"); @@ -140,10 +137,9 @@ if ($modetax==0) // Invoice for goods, payment for services //$periodlink=($year_start?"".img_previous()." ".img_next()."":""); $description=$langs->trans("RulesVATIn"); //if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='
'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite'); - if ($conf->global->MAIN_MODULE_COMPTABILITE) $description.='
'.$langs->trans("WarningDepositsNotIncluded"); - $description.=$fsearch; + $description.=$fsearch; $description.='
('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')'; - $builddate=time(); + $builddate=time(); //$exportlink=$langs->trans("NotYetAvailable"); $elementcust=$langs->trans("CustomersInvoices"); @@ -171,7 +167,7 @@ print ""; print ''.$langs->trans("Num").""; print ''.$langs->trans("Customer").""; print "".$langs->trans("VATIntra").""; -print "".$langs->trans("AmountHTVATRealReceived").""; +print "".$langs->trans("SalesTurnover")." ".$langs->trans("HT").""; print "".$vatcust.""; print "\n"; @@ -179,7 +175,7 @@ $coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'sell'); if (is_array($coll_list)) { $var=true; - $total = 0; $totalamount = 0; + $total = 0; $subtotal = 0; $i = 1; foreach($coll_list as $coll) { @@ -195,11 +191,10 @@ if (is_array($coll_list)) } else { - //$intra = $langs->trans('NotRegistered'); - $intra = ''; + $intra = $langs->trans('NotRegistered'); } } - print ""; + print ""; print "".$i.""; $company_static->id=$coll->socid; $company_static->nom=$coll->nom; @@ -209,17 +204,13 @@ if (is_array($coll_list)) print "".$intra.""; print "".price($coll->amount).""; print "".price($coll->tva).""; - $totalamount = $totalamount + $coll->amount; $total = $total + $coll->tva; print "\n"; $i++; } } - $x_coll_sum = $total; - print ''.$langs->trans("Total").':'; - print ''.price($totalamount).''; - print ''.price($total).''; + print ''.$langs->trans("Total").':'.price($total).''; print ''; } else @@ -246,7 +237,7 @@ print ""; print ''.$langs->trans("Num").""; print ''.$langs->trans("Supplier").""; print "".$langs->trans("VATIntra").""; -print "".$langs->trans("AmountHTVATRealPaid").""; +print "".$langs->trans("Outcome")." ".$langs->trans("HT").""; print "".$vatsup.""; print "\n"; @@ -256,7 +247,7 @@ $coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'buy'); if (is_array($coll_list)) { $var=true; - $total = 0; $totalamount = 0; + $total = 0; $subtotal = 0; $i = 1; foreach($coll_list as $coll) { @@ -272,8 +263,7 @@ if (is_array($coll_list)) } else { - //$intra = $langs->trans('NotRegistered'); - $intra = ''; + $intra = $langs->trans('NotRegistered'); } } print ""; @@ -286,30 +276,14 @@ if (is_array($coll_list)) print "".$intra.""; print "".price($coll->amount).""; print "".price($coll->tva).""; - $totalamount = $totalamount + $coll->amount; $total = $total + $coll->tva; print "\n"; $i++; } } - $x_paye_sum = $total; - print ''.$langs->trans("Total").':'; - print ''.price($totalamount).''; - print ''.price($total).''; + print ''.$langs->trans("Total").':'.price($total).''; print ''; - - print ''; - - // Total to pay - print '

'; - print ''; - $diff = $x_coll_sum - $x_paye_sum; - print ''; - print ''; - print '\n"; - print "\n"; - } else { @@ -327,5 +301,5 @@ print '
'.$langs->trans("TotalToPay").($q?', '.$langs->trans("Quadri").' '.$q:'').''.price(price2num($diff,'MT'))."
'; $db->close(); -llxFooter('$Date: 2011/07/18 11:11:19 $ - $Revision: 1.31 $'); +llxFooter('$Date$ - $Revision$'); ?> diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index 315069dc086..cecc88d2e9f 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -23,7 +23,7 @@ * \file htdocs/compta/tva/quadri_detail.php * \ingroup tax * \brief Trimestrial page - detailed version - * \version $Id: quadri_detail.php,v 1.43 2011/07/18 11:11:19 eldy Exp $ + * \version $Id$ * \todo Deal with recurrent invoices as well */ @@ -44,7 +44,7 @@ $langs->load("companies"); $langs->load("products"); // Date range -$year=GETPOST("year"); +$year=$_REQUEST["year"]; if (empty($year)) { $year_current = strftime("%Y",dol_now()); @@ -58,26 +58,24 @@ $date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday" // Quarter if (empty($date_start) || empty($date_end)) // We define date_start and date_end { - $q=GETPOST("q"); - if (empty($q)) + $q=(! empty($_REQUEST["q"]))?$_REQUEST["q"]:0; + if ($q==0) { if (isset($_REQUEST["month"])) { $date_start=dol_get_first_day($year_start,$_REQUEST["month"],false); $date_end=dol_get_last_day($year_start,$_REQUEST["month"],false); } - else - { - $month_current = strftime("%m",dol_now()); - if ($month_current >= 10) $q=4; - elseif ($month_current >= 7) $q=3; - elseif ($month_current >= 4) $q=2; - else $q=1; - } + else $q=1; } 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); } if ($q==4) { $date_start=dol_get_first_day($year_start,10,false); $date_end=dol_get_last_day($year_start,12,false); } } +else +{ + // TODO We define q -$min = GETPOST("min"); +} + +$min = $_REQUEST["min"]; if (empty($min)) $min = 0; // Define modetax (0 or 1) @@ -87,7 +85,7 @@ if (isset($_REQUEST["modetax"])) $modetax=$_REQUEST["modetax"]; if (empty($modetax)) $modetax=0; // Security check -$socid = GETPOST("socid"); +$socid = isset($_REQUEST["socid"])?$_REQUEST["socid"]:''; if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'tax', '', '', 'charges'); @@ -136,10 +134,9 @@ if ($modetax==1) // Calculate on invoice for goods and services else { $nextquarter=1; $nextyear++; } //$periodlink=($prevyear?"".img_previous()." ".img_next()."":""); $description=$langs->trans("RulesVATDue"); - //if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='
'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite'); - if ($conf->global->MAIN_MODULE_COMPTABILITE) $description.='
'.$langs->trans("WarningDepositsNotIncluded"); $description.='
('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')'; - $description.=$fsearch; + //if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='
'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite'); + $description.=$fsearch; $builddate=time(); //$exportlink=$langs->trans("NotYetAvailable"); @@ -167,8 +164,7 @@ if ($modetax==0) // Invoice for goods, payment for services //$periodlink=($prevyear?"".img_previous()." ".img_next()."":""); $description=$langs->trans("RulesVATIn"); //if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='
'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite'); - if ($conf->global->MAIN_MODULE_COMPTABILITE) $description.='
'.$langs->trans("WarningDepositsNotIncluded"); - $description.=$fsearch; + $description.=$fsearch; $description.='
('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')'; $builddate=time(); //$exportlink=$langs->trans("NotYetAvailable"); @@ -192,10 +188,14 @@ $vatsup=$langs->trans("VATPaid"); // VAT Received and paid +//print "
"; +//print_titre($vatcust); + echo ''; $y = $year_current; $total = 0; +$subtotal = 0; $i=0; // Load arrays of datas @@ -416,36 +416,21 @@ else $x_coll_sum += $temp_vat; } } - // Total customers for this vat rate - print ''; - print ''; - print ''; - if ($modetax == 0) - { - print ''; - print ''; - } - print ''; - print ''; - print ''; + + // Total customers + print ''; + print ''; + print ''; + if ($modetax == 0) + { + print ''; + print ''; + } + print ''; + print ''; + print ''; } - if (count($x_coll) == 0) // Show a total ine if nothing shown - { - print ''; - print ''; - print ''; - if ($modetax == 0) - { - print ''; - print ''; - } - print ''; - print ''; - print ''; - } - - // Blank line print ''; //print table headers for this quadri - expenses now @@ -567,51 +552,41 @@ else $x_paye_sum += $temp_vat; } } - // Total suppliers for this vat rate - print ''; - print ''; - print ''; - if ($modetax == 0) - { - print ''; - print ''; - } - print ''; - print ''; - print ''; + + // Total suppliers + print ''; + print ''; + print ''; + if ($modetax == 0) + { + print ''; + print ''; + } + print ''; + print ''; + print ''; } - if (count($x_paye) == 0) // Show a total ine if nothing shown - { - print ''; - print ''; - print ''; - if ($modetax == 0) - { - print ''; - print ''; - } - print ''; - print ''; - print ''; - } - - print '
'.$langs->trans("Total").':  '.price(price2num($subtot_coll_total_ht,'MT')).''.price(price2num($subtot_coll_vat,'MT')).'
'.$langs->trans("Total").':  '.price(price2num($subtot_coll_total_ht,'MT')).''.price(price2num($subtot_coll_vat,'MT')).'
 '.$langs->trans("Total").':  '.price(price2num(0,'MT')).''.price(price2num(0,'MT')).'
 
 '.$langs->trans("Total").':  '.price(price2num($subtot_paye_total_ht,'MT')).''.price(price2num($subtot_paye_vat,'MT')).'
 '.$langs->trans("Total").':  '.price(price2num($subtot_paye_total_ht,'MT')).''.price(price2num($subtot_paye_vat,'MT')).'
 '.$langs->trans("Total").':  '.price(price2num(0,'MT')).''.price(price2num(0,'MT')).'
'; + print ' '; // Total to pay - print '

'; - print ''; - $diff = $x_coll_sum - $x_paye_sum; + print ''; + print ''; + print ''."\n"; + + $diff = $x_coll_sum - $x_paye_sum; print ''; - print ''; + print ''; print '\n"; print "\n"; + //print ''."\n"; + $i++; } echo '
'.$langs->trans("TotalToPay").($q?', '.$langs->trans("Quadri").' '.$q:'').':
'.$langs->trans("TotalToPay").($q?', '.$langs->trans("Quadri").' '.$q:'').''.price(price2num($diff,'MT'))."
 
'; $db->close(); -llxFooter('$Date: 2011/07/18 11:11:19 $ - $Revision: 1.43 $'); +llxFooter('$Date$ - $Revision$'); ?> diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index 50c3f887959..a08d440d5ef 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -128,4 +128,3 @@ InvoiceRef=Invoice ref. CodeNotDef=Not defined AddRemind=Dispatch available amount RemainToDivide= Remain to dispatch : -WarningDepositsNotIncluded=Deposits invoices are not included in this version with this accountancy module. \ No newline at end of file diff --git a/htdocs/langs/fr_FR/compta.lang b/htdocs/langs/fr_FR/compta.lang index f2d91f35f70..143737924e3 100644 --- a/htdocs/langs/fr_FR/compta.lang +++ b/htdocs/langs/fr_FR/compta.lang @@ -139,5 +139,4 @@ COMPTA_VAT_ACCOUNT=Code comptable par défaut pour TVA (si non défini dans dict COMPTA_ACCOUNT_CUSTOMER=Code comptable client par défaut (si non défini sur fiche tiers) COMPTA_ACCOUNT_SUPPLIER=Code comptable fournisseur par défaut (si non défini sur fiche tiers) AddRemind=Ventiler montant disponible -RemainToDivide=Reste à répartir : -WarningDepositsNotIncluded=Les factures d'accomptes ne sont pas encore prises en compte dans cette version avec ce module de comptabilité. \ No newline at end of file +RemainToDivide=Reste à répartir : \ No newline at end of file diff --git a/htdocs/lib/tax.lib.php b/htdocs/lib/tax.lib.php index 82e5cad0bc2..3a1ad141ebd 100644 --- a/htdocs/lib/tax.lib.php +++ b/htdocs/lib/tax.lib.php @@ -21,7 +21,7 @@ * \file htdocs/lib/tax.lib.php * \ingroup tax * \brief Library for tax module - * \version $Id: tax.lib.php,v 1.21 2011/07/18 11:11:19 eldy Exp $ + * \version $Id: tax.lib.php,v 1.20 2011/07/04 09:01:37 eldy Exp $ */ @@ -142,8 +142,8 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction } if (! $sql) return -1; - if ($sql == 'TODO') return -2; - if ($sql != 'TODO') + if ($sql && $sql=='TODO') return -2; + if ($sql && $sql!='TODO') { dol_syslog("Tax.lib:thirdparty sql=".$sql); $resql = $db->query($sql); @@ -316,8 +316,8 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, //print $sql.'
'; if (! $sql) return -1; - if ($sql == 'TODO') return -2; - if ($sql != 'TODO') + if ($sql && $sql=='TODO') return -2; + if ($sql && $sql!='TODO') { dol_syslog("Tax.lib.php::vat_by_date sql=".$sql); @@ -477,8 +477,8 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, dol_syslog("Tax.lib.php::vat_by_date no accountancy module enabled".$sql,LOG_ERR); return -1; // -1 = Not accountancy module enabled } - if ($sql == 'TODO') return -2; // -2 = Feature not yet available - if ($sql != 'TODO') + if ($sql && $sql=='TODO') return -2; // -2 = Feature not yet available + if ($sql && $sql!='TODO') { dol_syslog("Tax.lib.php::vat_by_date sql=".$sql); $resql = $db->query($sql);