diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index b58ac1d1e93..b7d537c3954 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -26,7 +26,7 @@ /** * \file htdocs/compta/paiement/list.php * \ingroup compta - * \brief Page liste des paiements des factures clients + * \brief Payment page for customer invoices */ require '../../main.inc.php'; @@ -37,9 +37,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; // Load translation files required by the page -$langs->loadLangs(array('bills', 'compta', 'companies')); +$langs->loadLangs(array('bills', 'banks', 'compta', 'companies')); + +$action = GETPOST('action', 'alpha'); +$confirm = GETPOST('confirm', 'alpha'); +$optioncss = GETPOST('optioncss', 'alpha'); -// Security check $facid = GETPOST('facid', 'int'); $socid = GETPOST('socid', 'int'); $userid = GETPOST('userid', 'int'); @@ -47,6 +50,7 @@ $day = GETPOST('day', 'int'); $month = GETPOST('month', 'int'); $year = GETPOST('year', 'int'); +// Security check if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'facture', $facid, ''); @@ -83,7 +87,7 @@ $arrayfields=array(); * Actions */ -if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers +if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers { $search_ref=""; $search_account=""; @@ -94,22 +98,22 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', $day=''; $year=''; $month=''; + $search_array_options=array(); } - /* * View */ -llxHeader('', $langs->trans('ListPayment')); - $form=new Form($db); $formother=new FormOther($db); -if (GETPOST("orphelins")) +llxHeader('', $langs->trans('ListPayment')); + +if (GETPOST("orphelins","alpha")) { - // Paiements lies a aucune facture (pour aide au diagnostic) + // Payments not linked to an invoice. Should not happend. For debug only. $sql = "SELECT p.rowid, p.ref, p.datep as dp, p.amount,"; $sql.= " p.statut, p.num_paiement,"; $sql.= " c.code as paiement_code"; @@ -197,7 +201,6 @@ $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); - $i = 0; $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); @@ -213,6 +216,7 @@ if ($resql) if ($optioncss != '') print ''; print ''; print ''; + print ''; print ''; print ''; print ''; @@ -228,18 +232,18 @@ if ($resql) print ''; print ''; print ''; - print ''; + print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; print ''; $formother->select_year($year?$year:-1, 'year', 1, 20, 5); print ''; - print ''; + print ''; print ''; print ''; print ''; $form->select_types_paiements($search_paymenttype, 'search_paymenttype', '', 2, 1, 1); print ''; - print ''; + print ''; print ''; print ''; if (! empty($conf->banque->enabled)) @@ -264,7 +268,7 @@ if ($resql) print ''; print_liste_field_titre("RefPayment", $_SERVER["PHP_SELF"], "p.rowid", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "dp", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "dp", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "c.libelle", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Numero", $_SERVER["PHP_SELF"], "p.num_paiement", "", $param, "", $sortfield, $sortorder); @@ -283,6 +287,8 @@ if ($resql) print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); print "\n"; + $i = 0; + $totalarray=array(); while ($i < min($num, $limit)) { $objp = $db->fetch_object($resql); @@ -290,35 +296,39 @@ if ($resql) $paymentstatic->id=$objp->rowid; $paymentstatic->ref=$objp->ref; + $companystatic->id=$objp->socid; + $companystatic->name=$objp->name; + $companystatic->email=$objp->email; + print ''; print ''; print $paymentstatic->getNomUrl(1); print ''; + if (! $i) $totalarray['nbfield']++; // Date $dateformatforpayment = 'day'; if (! empty($conf->global->INVOICE_USE_HOURS_FOR_PAYMENT)) $dateformatforpayment='dayhour'; print ''.dol_print_date($db->jdate($objp->dp), $dateformatforpayment).''; + if (! $i) $totalarray['nbfield']++; // Thirdparty print ''; if ($objp->socid > 0) { - $companystatic->id=$objp->socid; - $companystatic->name=$objp->name; - $companystatic->email=$objp->email; - print $companystatic->getNomUrl(1, '', 24); } - else print ' '; print ''; + if (! $i) $totalarray['nbfield']++; // Type print ''.$langs->trans("PaymentTypeShort".$objp->paiement_code).''; + if (! $i) $totalarray['nbfield']++; // Payment number print ''.$objp->num_paiement.''; + if (! $i) $totalarray['nbfield']++; // Account if (! empty($conf->banque->enabled)) @@ -338,11 +348,15 @@ if ($resql) print $accountstatic->getNomUrl(1); } - else print ' '; print ''; + if (! $i) $totalarray['nbfield']++; } + // Amount print ''.price($objp->amount).''; + if (! $i) $totalarray['nbfield']++; + $totalarray['pos'][7]='amount'; + $totalarray['val']['amount'] += $objp->amount; if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) { @@ -351,13 +365,39 @@ if ($resql) print $paymentstatic->LibStatut($objp->statut, 5); if ($objp->statut == 0) print ''; print ''; + if (! $i) $totalarray['nbfield']++; } - print ' '; - print ''; + print ''; + if (! $i) $totalarray['nbfield']++; + + print ''; $i++; } + + // Show total line + if (isset($totalarray['pos'])) + { + print ''; + $i=0; + while ($i < $totalarray['nbfield']) + { + $i++; + if (! empty($totalarray['pos'][$i])) print ''.price($totalarray['val'][$totalarray['pos'][$i]]).''; + else + { + if ($i == 1) + { + if ($num < $limit) print ''.$langs->trans("Total").''; + else print ''.$langs->trans("Totalforthispage").''; + } + else print ''; + } + } + print ''; + } + print "\n"; print ""; print "\n"; diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 22470bd4c81..aa24196ec2f 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -28,7 +28,7 @@ /** * \file htdocs/fourn/facture/paiement.php * \ingroup fournisseur,facture - * \brief Payment page for suppliers invoices + * \brief Payment page for supplier invoices */ require '../../main.inc.php'; @@ -38,11 +38,13 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +// Load translation files required by the page $langs->loadLangs(array('companies', 'bills', 'banks', 'compta')); -// Security check $action = GETPOST('action', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); +$optioncss = GETPOST('optioncss', 'alpha'); + $facid = GETPOST('facid', 'int'); $socid = GETPOST('socid', 'int'); $accountid = GETPOST('accountid', 'int'); @@ -50,24 +52,23 @@ $day = GETPOST('day', 'int'); $month = GETPOST('month', 'int'); $year = GETPOST('year', 'int'); -$search_ref=GETPOST("search_ref", "int"); +$search_ref=GETPOST("search_ref", "alpha"); $search_account=GETPOST("search_account", "int"); $search_paymenttype=GETPOST("search_paymenttype"); $search_amount=GETPOST("search_amount", 'alpha'); // alpha because we must be able to search on "< x" $search_company=GETPOST("search_company", 'alpha'); $search_payment_num=GETPOST('search_payment_num', 'alpha'); +$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); $page = GETPOST("page", 'int'); if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 -$offset = $conf->liste_limit * $page; +$offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="p.rowid"; -$optioncss = GETPOST('optioncss', 'alpha'); $amounts = array(); $amountsresttopay=array(); @@ -84,7 +85,7 @@ if ($user->societe_id > 0) // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('paymentsupplier')); +$hookmanager->initHooks(array('paymentsupplierlist')); $extrafields = new ExtraFields($db); // fetch optionals attributes and labels @@ -333,20 +334,20 @@ if (empty($reshook)) * View */ +$form=new Form($db); +$formother=new FormOther($db); + $supplierstatic=new Societe($db); $invoicesupplierstatic = new FactureFournisseur($db); llxHeader('', $langs->trans('ListPayment')); -$form=new Form($db); -$formother=new FormOther($db); - if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paiement') { $object = new FactureFournisseur($db); $result = $object->fetch($facid); - $datefacture=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); + $datefacture=dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); $dateinvoice=($datefacture==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datefacture); $sql = 'SELECT s.nom as name, s.rowid as socid,'; @@ -767,7 +768,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie /* * Show list */ -if (empty($action)) +if (empty($action) || $action == 'list') { $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); @@ -861,9 +862,10 @@ if (empty($action)) print_barre_liste($langs->trans('SupplierPayments'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy.png', 0, '', '', $limit); - print '
'; + print ''; if ($optioncss != '') print ''; print ''; + print ''; print ''; print ''; print ''; @@ -899,18 +901,21 @@ if (empty($action)) print ''; $formother->select_year($year?$year:-1, 'year', 1, 20, 5); print ''; - print ''; + print ''; print ''; print ''; print ''; $form->select_types_paiements($search_paymenttype, 'search_paymenttype', '', 2, 1, 1); print ''; - print ''; + print ''; print ''; print ''; - print ''; - $form->select_comptes($search_account, 'search_account', 0, '', 1); - print ''; + if (! empty($conf->banque->enabled)) + { + print ''; + $form->select_comptes($search_account, 'search_account', 0, '', 1); + print ''; + } print ''; print ''; print ''; @@ -926,12 +931,21 @@ if (empty($action)) print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], 's.nom', '', $param, '', $sortfield, $sortorder); print_liste_field_titre("Type", $_SERVER["PHP_SELF"], 'c.libelle', '', $param, '', $sortfield, $sortorder); print_liste_field_titre("Numero", $_SERVER["PHP_SELF"], "p.num_paiement", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Account", $_SERVER["PHP_SELF"], 'ba.label', '', $param, '', $sortfield, $sortorder); + if (! empty($conf->banque->enabled)) + { + print_liste_field_titre("Account", $_SERVER["PHP_SELF"], 'ba.label', '', $param, '', $sortfield, $sortorder); + } print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], 'p.amount', '', $param, '', $sortfield, $sortorder, 'right '); - //print_liste_field_titre("Invoice",$_SERVER["PHP_SELF"],'ref_supplier','',$param,'',$sortfield,$sortorder); - print_liste_field_titre(''); + + $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); + $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); print "\n"; + $i = 0; + $totalarray=array(); while ($i < min($num, $limit)) { $objp = $db->fetch_object($resql); @@ -940,32 +954,46 @@ if (empty($action)) // Ref payment print ''.img_object($langs->trans('ShowPayment'), 'payment').' '.$objp->pid.''; - + if (! $i) $totalarray['nbfield']++; + // Date $dateformatforpayment = 'day'; if (! empty($conf->global->INVOICE_USE_HOURS_FOR_PAYMENT)) $dateformatforpayment='dayhour'; print ''.dol_print_date($db->jdate($objp->dp), $dateformatforpayment)."\n"; - + if (! $i) $totalarray['nbfield']++; + // Thirdparty print ''; if ($objp->socid) print ''.img_object($langs->trans('ShowCompany'), 'company').' '.dol_trunc($objp->name, 32).''; else print ' '; print ''; - + if (! $i) $totalarray['nbfield']++; + // Type $payment_type = $langs->trans("PaymentType".$objp->paiement_type)!=("PaymentType".$objp->paiement_type)?$langs->trans("PaymentType".$objp->paiement_type):$objp->paiement_libelle; print ''.$payment_type.' '.dol_trunc($objp->num_paiement, 32)."\n"; - + if (! $i) $totalarray['nbfield']++; + // Payment number print ''.$objp->num_paiement.''; - - print ''; - if ($objp->bid) print ''.img_object($langs->trans("ShowAccount"), 'account').' '.dol_trunc($objp->label, 24).''; - else print ' '; - print ''; - + if (! $i) $totalarray['nbfield']++; + + // Account + if (! empty($conf->banque->enabled)) + { + print ''; + if ($objp->bid) print ''.img_object($langs->trans("ShowAccount"), 'account').' '.dol_trunc($objp->label, 24).''; + else print ' '; + print ''; + if (! $i) $totalarray['nbfield']++; + } + + // Amount print ''.price($objp->pamount).''; - + if (! $i) $totalarray['nbfield']++; + $totalarray['pos'][7]='amount'; + $totalarray['val']['amount'] += $objp->pamount; + // Ref invoice /*$invoicesupplierstatic->ref=$objp->ref_supplier; $invoicesupplierstatic->id=$objp->facid; @@ -973,10 +1001,35 @@ if (empty($action)) print $invoicesupplierstatic->getNomUrl(1); print '';*/ - print ' '; + print ''; + if (! $i) $totalarray['nbfield']++; + print ''; $i++; } + + // Show total line + if (isset($totalarray['pos'])) + { + print ''; + $i=0; + while ($i < $totalarray['nbfield']) + { + $i++; + if (! empty($totalarray['pos'][$i])) print ''.price($totalarray['val'][$totalarray['pos'][$i]]).''; + else + { + if ($i == 1) + { + if ($num < $limit) print ''.$langs->trans("Total").''; + else print ''.$langs->trans("Totalforthispage").''; + } + else print ''; + } + } + print ''; + } + print ""; print ""; print "
\n"; diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index dc6ae7dc02e..4c71ce4b564 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -60,4 +60,5 @@ CashDeskBankAccountFor=Default account to use for payments in NoPaimementModesDefined=No paiment mode defined in TakePOS configuration TicketVatGrouped=Group VAT by rate in tickets AutoPrintTickets=Automatically print tickets -EnableBarOrRestaurantFeatures=Enable features for Bar or Restaurant \ No newline at end of file +EnableBarOrRestaurantFeatures=Enable features for Bar or Restaurant +ConfirmDeletionOfThisPOSSale=Do your confirm the deletion of this current sale ? \ No newline at end of file diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 46df42c4c52..d30adb72ef0 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -225,11 +225,11 @@ if ($action == "addnote") { } if ($action == "deleteline") { - if ($idline > 0 and $placeid > 0) { //If exist invoice and line, to avoid errors if deleted from other device or no line selected + if ($idline > 0 and $placeid > 0) { // If invoice exists and line selected. To avoid errors if deleted from another device or no line selected. $invoice->deleteline($idline); $invoice->fetch($placeid); } - elseif ($placeid > 0) { //If exist invoice, but no line selected, proceed to delete last line + elseif ($placeid > 0) { // If invoice exists but no line selected, proceed to delete last line. $sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "facturedet where fk_facture='".$placeid."' order by rowid DESC"; $resql = $db->query($sql); $row = $db->fetch_array($resql); @@ -239,6 +239,19 @@ if ($action == "deleteline") { } } +if ($action == "delete") { + if ($placeid > 0) { //If invoice exists + $result = $invoice->fetch($placeid); + if ($result > 0) + { + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "facturedet where fk_facture='".$placeid."'"; + $resql = $db->query($sql); + + $invoice->fetch($placeid); + } + } +} + if ($action == "updateqty") { foreach($invoice->lines as $line) diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index 0950851054b..49a240cee1c 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -380,6 +380,16 @@ function Refresh() { }); } +function New() { + console.log("New"); + var r = confirm('trans("ConfirmDeletionOfThisPOSSale"); ?>'); + if (r == true) { + $("#poslines").load("invoice.php?action=delete&place="+place, function() { + //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); + }); + } +} + function Search2() { console.log("Search2"); pageproducts=0; @@ -585,7 +595,17 @@ if (count($maincategories)==0) { // User menu and external TakePOS modules $menus = array(); $r=0; -//$menus[$r++]=array('title'=>'
'.$langs->trans("SearchProduct").'
', 'action'=>'Search();'); + +if (empty($conf->global->TAKEPOS_BAR_RESTAURANT)) +{ + $menus[$r++]=array('title'=>'
'.$langs->trans("New").'
', 'action'=>'New();'); +} +else +{ + // BAR RESTAURANT specific menu + $menus[$r++]=array('title'=>'
'.$langs->trans("Floors").'
', 'action'=>'Floors();'); +} + $menus[$r++]=array('title'=>'
'.$langs->trans("Customer").'
', 'action'=>'Customer();'); $menus[$r++]=array('title'=>'
'.$langs->trans("FreeZone").'
', 'action'=>'FreeZone();'); $menus[$r++]=array('title'=>'
'.$langs->trans("Payment").'
', 'action'=>'CloseBill();'); @@ -593,7 +613,6 @@ $menus[$r++]=array('title'=>'
'.$langs->trans("Floors").'
', 'action'=>'Floors();'); if ($conf->global->TAKEPOS_ORDER_PRINTERS) { $menus[$r++]=array('title'=>$langs->trans("Order"), 'action'=>'TakeposPrintingOrder();'); diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index c1bcb65b775..02407700236 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1896,6 +1896,9 @@ span.fa.atoplogin, span.fa.atoplogin:hover { font-size: 16px; text-decoration: none !important; } +.atoplogin #dropdown-icon-down, .atoplogin #dropdown-icon-up { + font-size: 0.7em; +} img.login, img.printer, img.entity { /* padding: 0px 0px 0px 4px; */ /* margin: 0px 0px 0px 8px; */