Fix several errors with bank account module enabled on sale tax edition
This commit is contained in:
parent
7cc7ac5485
commit
4df9af1ba0
@ -229,7 +229,10 @@ if ($resql)
|
|||||||
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle","",$param,"",$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle","",$param,"",$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Numero"),$_SERVER["PHP_SELF"],"p.num_paiement","",$param,"",$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Numero"),$_SERVER["PHP_SELF"],"p.num_paiement","",$param,"",$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
|
if (! empty($conf->banque->enabled))
|
||||||
|
{
|
||||||
|
print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
|
||||||
|
}
|
||||||
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"p.amount","",$param,'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"p.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||||
//print_liste_field_titre($langs->trans("Invoices"),"","","",$param,'align="left"',$sortfield,$sortorder);
|
//print_liste_field_titre($langs->trans("Invoices"),"","","",$param,'align="left"',$sortfield,$sortorder);
|
||||||
|
|
||||||
@ -260,9 +263,12 @@ if ($resql)
|
|||||||
print '<td align="left">';
|
print '<td align="left">';
|
||||||
print '<input class="flat" type="text" size="4" name="search_payment_num" value="'.$search_payment_num.'">';
|
print '<input class="flat" type="text" size="4" name="search_payment_num" value="'.$search_payment_num.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
if (! empty($conf->banque->enabled))
|
||||||
$form->select_comptes($search_account,'search_account',0,'',1);
|
{
|
||||||
print '</td>';
|
print '<td>';
|
||||||
|
$form->select_comptes($search_account,'search_account',0,'',1);
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
print '<input class="flat" type="text" size="4" name="search_amount" value="'.$search_amount.'">';
|
print '<input class="flat" type="text" size="4" name="search_amount" value="'.$search_amount.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -310,15 +316,20 @@ if ($resql)
|
|||||||
// Payment number
|
// Payment number
|
||||||
print '<td>'.$objp->num_paiement.'</td>';
|
print '<td>'.$objp->num_paiement.'</td>';
|
||||||
|
|
||||||
print '<td>';
|
// Account
|
||||||
if ($objp->bid)
|
if (! empty($conf->banque->enabled))
|
||||||
{
|
{
|
||||||
$accountstatic->id=$objp->bid;
|
print '<td>';
|
||||||
$accountstatic->label=$objp->label;
|
if ($objp->bid)
|
||||||
print $accountstatic->getNomUrl(1);
|
{
|
||||||
}
|
$accountstatic->id=$objp->bid;
|
||||||
else print ' ';
|
$accountstatic->label=$objp->label;
|
||||||
print '</td>';
|
print $accountstatic->getNomUrl(1);
|
||||||
|
}
|
||||||
|
else print ' ';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
// Amount
|
||||||
print '<td align="right">'.price($objp->amount).'</td>';
|
print '<td align="right">'.price($objp->amount).'</td>';
|
||||||
|
|
||||||
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
|
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||||
*
|
*
|
||||||
@ -266,18 +266,18 @@ if ($action == 'create')
|
|||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Account").'</td><td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Account").'</td><td>';
|
||||||
$form->select_comptes($_POST["accountid"],"accountid",0,"courant=1",1); // Affiche liste des comptes courant
|
$form->select_comptes($_POST["accountid"],"accountid",0,"courant=1",1); // Affiche liste des comptes courant
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
// Type payment
|
// Type payment
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
|
||||||
$form->select_types_paiements(GETPOST("type_payment"), "type_payment");
|
$form->select_types_paiements(GETPOST("type_payment"), "type_payment");
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
// Number
|
// Number
|
||||||
print '<tr><td>'.$langs->trans('Numero');
|
print '<tr><td>'.$langs->trans('Numero');
|
||||||
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
|
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
|
||||||
print '<td><input name="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n";
|
print '<td><input name="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n";
|
||||||
}
|
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$parameters=array('colspan' => ' colspan="1"');
|
$parameters=array('colspan' => ' colspan="1"');
|
||||||
|
|||||||
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||||
|
|
||||||
@ -40,6 +41,7 @@ $result = restrictedArea($user, 'tax', '', '', 'charges');
|
|||||||
$search_ref = GETPOST('search_ref','int');
|
$search_ref = GETPOST('search_ref','int');
|
||||||
$search_label = GETPOST('search_label','alpha');
|
$search_label = GETPOST('search_label','alpha');
|
||||||
$search_amount = GETPOST('search_amount','alpha');
|
$search_amount = GETPOST('search_amount','alpha');
|
||||||
|
$search_account = GETPOST('search_account','int');
|
||||||
$month = GETPOST("month","int");
|
$month = GETPOST("month","int");
|
||||||
$year = GETPOST("year","int");
|
$year = GETPOST("year","int");
|
||||||
|
|
||||||
@ -71,16 +73,18 @@ else
|
|||||||
$typeid=$_REQUEST['typeid'];
|
$typeid=$_REQUEST['typeid'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_ref="";
|
$search_ref="";
|
||||||
$search_label="";
|
$search_label="";
|
||||||
$search_amount="";
|
$search_amount="";
|
||||||
|
$search_account='';
|
||||||
$year="";
|
$year="";
|
||||||
$month="";
|
$month="";
|
||||||
$typeid="";
|
$typeid="";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
@ -90,14 +94,19 @@ llxHeader();
|
|||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$formother=new FormOther($db);
|
$formother=new FormOther($db);
|
||||||
$tva_static = new Tva($db);
|
$tva_static = new Tva($db);
|
||||||
|
$accountstatic = new Account($db);
|
||||||
|
|
||||||
$sql = "SELECT t.rowid, t.amount, t.label, t.datev as dv, t.datep as dp, t.fk_typepayment as type, t.num_payment, pst.code as payment_code";
|
$sql = "SELECT t.rowid, t.amount, t.label, t.datev as dv, t.datep as dp, t.fk_typepayment as type, t.num_payment, t.fk_bank, pst.code as payment_code,";
|
||||||
|
$sql.= " ba.rowid as bid, ba.label as blabel";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
|
$sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON t.fk_typepayment = pst.id";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON t.fk_typepayment = pst.id";
|
||||||
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON t.fk_bank = b.rowid";
|
||||||
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
||||||
$sql.= " WHERE t.entity = ".$conf->entity;
|
$sql.= " WHERE t.entity = ".$conf->entity;
|
||||||
if ($search_ref) $sql.=" AND t.rowid=".$search_ref;
|
if ($search_ref) $sql.=" AND t.rowid=".$search_ref;
|
||||||
if ($search_label) $sql.=" AND t.label LIKE '%".$db->escape($search_label)."%'";
|
if ($search_label) $sql.=" AND t.label LIKE '%".$db->escape($search_label)."%'";
|
||||||
if ($search_amount) $sql.=" AND t.amount='".$db->escape(price2num(trim($search_amount)))."'";
|
if ($search_amount) $sql.=" AND t.amount='".$db->escape(price2num(trim($search_amount)))."'";
|
||||||
|
if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account;
|
||||||
if ($month > 0)
|
if ($month > 0)
|
||||||
{
|
{
|
||||||
if ($year > 0)
|
if ($year > 0)
|
||||||
@ -155,8 +164,12 @@ if ($result)
|
|||||||
print_liste_field_titre($langs->trans("DateValue"),$_SERVER["PHP_SELF"],"dv","",$param,'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("DateValue"),$_SERVER["PHP_SELF"],"dv","",$param,'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"dp","",$param,'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"dp","",$param,'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
|
||||||
|
if (! empty($conf->banque->enabled))
|
||||||
|
{
|
||||||
|
print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
|
||||||
|
}
|
||||||
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"t.amount","",$param,'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"t.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
@ -172,8 +185,13 @@ if ($result)
|
|||||||
print '<td class="liste_titre" align="left">';
|
print '<td class="liste_titre" align="left">';
|
||||||
$form->select_types_paiements($typeid,'typeid','',0,0,1,16);
|
$form->select_types_paiements($typeid,'typeid','',0,0,1,16);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
if (! empty($conf->banque->enabled))
|
||||||
|
{
|
||||||
|
print '<td>';
|
||||||
|
$form->select_comptes($search_account,'search_account',0,'',1);
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
print '<td class="liste_titre" align="right"><input name="search_amount" class="flat" type="text" size="8" value="'.$search_amount.'"></td>';
|
print '<td class="liste_titre" align="right"><input name="search_amount" class="flat" type="text" size="8" value="'.$search_amount.'"></td>';
|
||||||
|
|
||||||
print '<td class="liste_titre" align="right">';
|
print '<td class="liste_titre" align="right">';
|
||||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||||
print $searchpitco;
|
print $searchpitco;
|
||||||
@ -204,15 +222,32 @@ if ($result)
|
|||||||
print '<td align="center">'.dol_print_date($db->jdate($obj->dp),'day')."</td>\n";
|
print '<td align="center">'.dol_print_date($db->jdate($obj->dp),'day')."</td>\n";
|
||||||
// Type
|
// Type
|
||||||
print $type;
|
print $type;
|
||||||
|
// Account
|
||||||
|
if (! empty($conf->banque->enabled))
|
||||||
|
{
|
||||||
|
print '<td>';
|
||||||
|
if ($obj->fk_bank > 0)
|
||||||
|
{
|
||||||
|
//$accountstatic->fetch($obj->fk_bank);
|
||||||
|
$accountstatic->id=$obj->bid;
|
||||||
|
$accountstatic->label=$obj->blabel;
|
||||||
|
print $accountstatic->getNomUrl(1);
|
||||||
|
}
|
||||||
|
else print ' ';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
// Amount
|
// Amount
|
||||||
$total = $total + $obj->amount;
|
$total = $total + $obj->amount;
|
||||||
print "<td align=\"right\">".price($obj->amount)."</td>";
|
print "<td align=\"right\">".price($obj->amount)."</td>";
|
||||||
print "<td> </td>";
|
print "<td> </td>";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
print '<tr class="liste_total"><td colspan="5">'.$langs->trans("Total").'</td>';
|
|
||||||
|
$colspan=5;
|
||||||
|
if (! empty($conf->banque->enabled)) $colspan++;
|
||||||
|
print '<tr class="liste_total"><td colspan="'.$colspan.'">'.$langs->trans("Total").'</td>';
|
||||||
print "<td align=\"right\"><b>".price($total)."</b></td>";
|
print "<td align=\"right\"><b>".price($total)."</b></td>";
|
||||||
print "<td> </td></tr>";
|
print "<td> </td></tr>";
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user