* Copyright (C) 2007-2011 Laurent Destailleur * Copyright (C) 2009-2012 Regis Houssin * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2013 Philippe Grand * Copyright (C) 2015 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file htdocs/compta/paiement/cheque/card.php * \ingroup bank, invoice * \brief Page for cheque deposits */ require '../../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; $langs->load("banks"); $langs->load("categories"); $langs->load('bills'); $langs->load('companies'); $langs->load('compta'); $id =GETPOST('id','int'); $ref=GETPOST('ref', 'alpha'); $action=GETPOST('action', 'alpha'); $confirm=GETPOST('confirm', 'alpha'); // Security check $fieldname = (! empty($ref)?'number':'rowid'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'cheque', $id, 'bordereau_cheque','','',$fieldname); $sortfield=GETPOST('sortfield', 'alpha'); $sortorder=GETPOST('sortorder', 'alpha'); $page=GETPOST('page', 'int'); if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="b.dateo,b.rowid"; if ($page < 0) { $page = 0 ; } $limit = $conf->liste_limit; $offset = $limit * $page ; $dir=$conf->banque->dir_output.'/bordereau/'; $filterdate=dol_mktime(0, 0, 0, GETPOST('fdmonth'), GETPOST('fdday'), GETPOST('fdyear')); $filteraccountid=GETPOST('accountid'); $object = new RemiseCheque($db); /* * Actions */ if ($action == 'setdate' && $user->rights->banque->cheque) { $result = $object->fetch(GETPOST('id','int')); if ($result > 0) { //print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; $date=dol_mktime(0, 0, 0, $_POST['datecreate_month'], $_POST['datecreate_day'], $_POST['datecreate_year']); $result=$object->set_date($user,$date); if ($result < 0) { setEventMessage($object->error, 'errors'); } } else { setEventMessage($object->error, 'errors'); } } if ($action == 'setrefext' && $user->rights->banque->cheque) { $result = $object->fetch(GETPOST('id','int')); if ($result > 0) { $ref_ext = GETPOST('ref_ext'); $result=$object->setValueFrom('ref_ext', $ref_ext); if ($result < 0) { setEventMessage($object->error, 'errors'); } } else { setEventMessage($object->error, 'errors'); } } if ($action == 'setref' && $user->rights->banque->cheque) { $result = $object->fetch(GETPOST('id','int')); if ($result > 0) { $number=GETPOST('number'); $result=$object->set_number($user,$number); if ($result < 0) { setEventMessage($object->error, 'errors'); } } else { setEventMessage($object->error, 'errors'); } } if ($action == 'create' && $_POST["accountid"] > 0 && $user->rights->banque->cheque) { if (is_array($_POST['toRemise'])) { $result = $object->create($user, $_POST["accountid"], 0, $_POST['toRemise']); if ($result > 0) { if ($object->statut == 1) // If statut is validated, we build doc { $object->fetch($object->id); // To force to reload all properties in correct property name // Define output language $outputlangs = $langs; $newlang=''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; //if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } $result = $object->generatePdf($_POST["model"], $outputlangs); } header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); exit; } else { setEventMessage($object->error, 'errors'); } } else { setEventMessage($langs->trans("ErrorSelectAtLeastOne")); $action='new'; } } if ($action == 'remove' && $id > 0 && $_GET["lineid"] > 0 && $user->rights->banque->cheque) { $object->id = $id; $result = $object->removeCheck($_GET["lineid"]); if ($result === 0) { header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); exit; } else { setEventMessage($object->error, 'errors'); } } if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->banque->cheque) { $object->id = $id; $result = $object->delete(); if ($result == 0) { header("Location: index.php"); exit; } else { setEventMessage($paiement->error, 'errors'); } } if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->banque->cheque) { $result = $object->fetch($id); $result = $object->validate($user); if ($result >= 0) { // Define output language $outputlangs = $langs; $newlang=''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; //if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } $result = $object->generatePdf(GETPOST('model'), $outputlangs); header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); exit; } else { setEventMessage($object->error, 'errors'); } } if ($action == 'confirm_reject_check' && $confirm == 'yes' && $user->rights->banque->cheque) { $reject_date = dol_mktime(0, 0, 0, GETPOST('rejectdate_month'), GETPOST('rejectdate_day'), GETPOST('rejectdate_year')); $rejected_check = GETPOST('bankid'); $object->fetch($id); $paiement_id = $object->rejectCheck($rejected_check, $reject_date); if ($paiement_id > 0) { setEventMessage($langs->trans("CheckRejectedAndInvoicesReopened")); //header("Location: ".DOL_URL_ROOT.'/compta/paiement/card.php?id='.$paiement_id); //exit; $action=''; } else { setEventMessages($object->error, $object->errors, 'errors'); $action=''; } } if ($action == 'builddoc' && $user->rights->banque->cheque) { $result = $object->fetch($id); // Save last template used to generate document //if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha')); $outputlangs = $langs; $newlang=''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; //if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } $result = $object->generatePdf($_POST["model"], $outputlangs); if ($result <= 0) { dol_print_error($db,$object->error); exit; } else { header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc')); exit; } } // Remove file in doc form if ($action == 'remove_file' && $user->rights->banque->cheque) { if ($object->fetch($id) > 0) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $langs->load("other"); $file=$dir.get_exdir($object->number,0,1,0,$object,'cheque') . GETPOST('file'); $ret=dol_delete_file($file,0,0,0,$object); if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('file'))); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), 'errors'); } } // Conciliation if ($action == 'rappro' && $user->rights->banque->consolidate) { $error=0; // Definition, nettoyage parametres $num_releve=trim($_POST["num_releve"]); if ($num_releve) { $bankline=new AccountLine($db); if (isset($_POST['rowid']) && is_array($_POST['rowid'])) { foreach($_POST['rowid'] as $row) { if($row > 0) { $result=$bankline->fetch($row); $bankline->num_releve=$num_releve; //$_POST["num_releve"]; $result=$bankline->update_conciliation($user,$_POST["cat"]); if ($result < 0) { setEventMessages($bankline->error, $bankline->errors, 'errors'); $error++; break; } } } } } else { $error++; $langs->load("errors"); setEventMessage($langs->trans("ErrorPleaseTypeBankTransactionReportName"), 'errors'); } if (! $error) { header('Location: '.DOL_URL_ROOT.'/compta/paiement/cheque/card.php?id='.$id); // To avoid to submit twice and allow back exit; } } /* * View */ if (GETPOST('removefilter')) { $filterdate=''; $filteraccountid=0; } llxHeader(); $form = new Form($db); $formfile = new FormFile($db); if ($action == 'new') { $h=0; $head[$h][0] = $_SERVER["PHP_SELF"].'?action=new'; $head[$h][1] = $langs->trans("MenuChequeDeposits"); $hselected = $h; $h++; print_fiche_titre($langs->trans("Cheques")); } else { $result = $object->fetch($id, $ref); if ($result < 0) { dol_print_error($db,$object->error); exit; } $h=0; $head[$h][0] = $_SERVER["PHP_SELF"].'?id='.$object->id; $head[$h][1] = $langs->trans("CheckReceipt"); $hselected = $h; $h++; // $head[$h][0] = DOL_URL_ROOT.'/compta/paiement/cheque/info.php?id='.$object->id; // $head[$h][1] = $langs->trans("Info"); // $h++; dol_fiche_head($head, $hselected, $langs->trans("Cheques"),0,'payment'); /* * Confirmation de la suppression du bordereau */ if ($action == 'delete') { print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans("DeleteCheckReceipt"), $langs->trans("ConfirmDeleteCheckReceipt"), 'confirm_delete','','',1); } /* * Confirmation de la validation du bordereau */ if ($action == 'valide') { print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans("ValidateCheckReceipt"), $langs->trans("ConfirmValidateCheckReceipt"), 'confirm_valide','','',1); } /* * Confirm check rejection */ if ($action == 'reject_check') { $formquestion = array( array('type' => 'hidden','name' => 'bankid','value' => GETPOST('lineid')), array('type' => 'date','name' => 'rejectdate_','label' => $langs->trans("RejectCheckDate"),'value' => dol_now()) ); print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans("RejectCheck"), $langs->trans("ConfirmRejectCheck"), 'confirm_reject_check',$formquestion,'',1); } } $accounts = array(); if ($action == 'new') { $paymentstatic=new Paiement($db); $accountlinestatic=new AccountLine($db); $lines = array(); $now=dol_now(); print $langs->trans("SelectChequeTransactionAndGenerate").'

'."\n"; print '
'; print ''; dol_fiche_head(); print ''; //print ''; // Filter print ''; print ''; print '
'.$langs->trans('Date').''.dol_print_date($now,'day').'
'.$langs->trans("DateChequeReceived").''; print $form->select_date($filterdate,'fd',0,0,1,'',1,1,1); print '
'.$langs->trans("BankAccount").''; $form->select_comptes($filteraccountid,'accountid',0,'courant <> 2',1); print '
'; dol_fiche_end(); print '
'; print ''; if ($filterdate || $filteraccountid > 0) { print '   '; print ''; } print '
'; print '
'; print '
'; $sql = "SELECT ba.rowid as bid, b.datec as datec, b.dateo as date, b.rowid as transactionid, "; $sql.= " b.amount, ba.label, b.emetteur, b.num_chq, b.banque,"; $sql.= " p.rowid as paymentid"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement as p ON p.fk_bank = b.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON (b.fk_account = ba.rowid)"; $sql.= " WHERE b.fk_type = 'CHQ'"; $sql.= " AND ba.entity IN (".getEntity('bank_account', 1).")"; $sql.= " AND b.fk_bordereau = 0"; $sql.= " AND b.amount > 0"; if ($filterdate) $sql.=" AND b.dateo = '".$db->idate($filterdate)."'"; if ($filteraccountid > 0) $sql.=" AND ba.rowid= '".$filteraccountid."'"; $sql.= $db->order("b.dateo,b.rowid","ASC"); $resql = $db->query($sql); if ($resql) { $i = 0; while ( $obj = $db->fetch_object($resql) ) { $accounts[$obj->bid] = $obj->label; $lines[$obj->bid][$i]["date"] = $db->jdate($obj->date); $lines[$obj->bid][$i]["amount"] = $obj->amount; $lines[$obj->bid][$i]["emetteur"] = $obj->emetteur; $lines[$obj->bid][$i]["numero"] = $obj->num_chq; $lines[$obj->bid][$i]["banque"] = $obj->banque; $lines[$obj->bid][$i]["id"] = $obj->transactionid; $lines[$obj->bid][$i]["paymentid"] = $obj->paymentid; $i++; } if ($i == 0) { print ''.$langs->trans("NoWaitingChecks").'
'; } } foreach ($accounts as $bid => $account_label) { print ' '; $num = $db->num_rows($resql); print '
'; print ''; print ''; print ''; print ''; print ''; print '\n"; print '\n"; print '\n"; print '\n"; print '\n"; print '\n"; print '\n"; print ''; print "\n"; $var=true; foreach ($lines[$bid] as $lid => $value) { $var=!$var; $account_id = $bid; if (! isset($accounts[$bid])) $accounts[$bid]=0; $accounts[$bid] += 1; print ""; print ''; print '\n"; print '\n"; print '\n"; print ''; // Link to payment print ''; // Link to bank transaction print ''; print '' ; print ''; $i++; } print "
'.$langs->trans("DateChequeReceived").' '; print "'.$langs->trans("ChequeNumber")."'.$langs->trans("CheckTransmitter")."'.$langs->trans("Bank")."'.$langs->trans("Amount")."'.$langs->trans("Payment")."'.$langs->trans("LineRecord")."'.$langs->trans("Select")."
"; if ($conf->use_javascript_ajax) print ''.$langs->trans("All").' / '.$langs->trans("None").''; print '
'.dol_print_date($value["date"],'day').''.$value["numero"]."'.$value["emetteur"]."'.$value["banque"]."'.price($value["amount"], 0, $langs, 1, -1, -1, $conf->currency).''; $paymentstatic->id=$value["paymentid"]; $paymentstatic->ref=$value["paymentid"]; if ($paymentstatic->id) { print $paymentstatic->getNomUrl(1); } else { print ' '; } print ''; $accountlinestatic->rowid=$value["id"]; if ($accountlinestatic->rowid) { print $accountlinestatic->getNomUrl(1); } else { print ' '; } print ''; print ''; print '
"; print '
'; if ($user->rights->banque->cheque) { print ''; } else { print ''.$langs->trans('NewCheckDepositOn',$account_label).''; } print '

'; print '
'; } } else { $linkback=''.$langs->trans("BackToList").''; $paymentstatic=new Paiement($db); $accountlinestatic=new AccountLine($db); $accountstatic=new Account($db); $accountstatic->id=$object->account_id; $accountstatic->label=$object->account_label; print ''; print ''; print ''; print ''; print ''; // External ref /* Ext ref are not visible field on standard usage print ''; print ''; */ print ''; // Nb of cheques print ''; print ''; print ''; print '
'; print ''; if ($action != 'editref') print ''; print '
'; print $langs->trans('Ref'); print 'id.'">'.img_edit($langs->trans('SetRef'),1).'
'; print '
'; if ($action == 'editref') { print '
'; print ''; print ''; print ''; print ''; print '
'; } else { print $form->showrefnav($object,'ref',$linkback, 1, 'number'); } print '
'; print ''; if ($action != 'editdate') print ''; print '
'; print $langs->trans('Date'); print 'id.'">'.img_edit($langs->trans('SetDate'),1).'
'; print '
'; if ($action == 'editdate') { print '
'; print ''; print ''; $form->select_date($object->date_bordereau,'datecreate_','','','',"setdate"); print ''; print '
'; } else { print $object->date_bordereau ? dol_print_date($object->date_bordereau,'day') : ' '; } print '
'; print ''; if ($action != 'editrefext') print ''; print '
'; print $langs->trans('RefExt'); print 'id.'">'.img_edit($langs->trans('SetRefExt'),1).'
'; print '
'; if ($action == 'editrefext') { print '
'; print ''; print ''; print ''; print ''; print '
'; } else { print $object->ref_ext; } print '
'.$langs->trans('Account').''; print $accountstatic->getNomUrl(1); print '
'.$langs->trans('NbOfCheques').''; print $object->nbcheque; print '
'.$langs->trans('Total').''; print price($object->amount); print '
'.$langs->trans('Status').''; print $object->getLibStatut(4); print '

'; // List of cheques $sql = "SELECT b.rowid, b.amount, b.num_chq, b.emetteur,"; $sql.= " b.dateo as date, b.datec as datec, b.banque,"; $sql.= " p.rowid as pid, ba.rowid as bid, p.statut"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON (b.fk_account = ba.rowid)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement as p ON p.fk_bank = b.rowid"; $sql.= " WHERE ba.entity IN (".getEntity('bank_account', 1).")"; $sql.= " AND b.fk_type= 'CHQ'"; $sql.= " AND b.fk_bordereau = ".$object->id; $sql.= $db->order($sortfield, $sortorder); $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); print ''; $param="&id=".$object->id; print ''; print_liste_field_titre($langs->trans("Cheques"),'','','','','width="30"'); print_liste_field_titre($langs->trans("DateChequeReceived"),$_SERVER["PHP_SELF"],"b.dateo,b.rowid", "",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Numero"),$_SERVER["PHP_SELF"],"b.num_chq", "",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("CheckTransmitter"),$_SERVER["PHP_SELF"],"b.emetteur", "",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Bank"),$_SERVER["PHP_SELF"],"b.banque", "",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"b.amount", "",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Payment"),$_SERVER["PHP_SELF"],"p.rowid", "",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("LineRecord"),$_SERVER["PHP_SELF"],"b.rowid", "",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre(''); print "\n"; $i=1; $var=false; while ($objp = $db->fetch_object($resql)) { $account_id = $objp->bid; if (! isset($accounts[$objp->bid])) $accounts[$objp->bid]=0; $accounts[$objp->bid] += 1; print ""; print ''; print ''; // Date operation print ''; print ''; print ''; print ''; // Link to payment print ''; // Link to bank transaction print ''; // Action button print ''; print ''; $var=!$var; $i++; } print "
'.$i.''.dol_print_date($db->jdate($objp->date),'day').''.($objp->num_chq?$objp->num_chq:' ').''.dol_trunc($objp->emetteur,24).''.dol_trunc($objp->banque,24).''.price($objp->amount).''; $paymentstatic->id=$objp->pid; $paymentstatic->ref=$objp->pid; if ($paymentstatic->id) { print $paymentstatic->getNomUrl(1); } else { print ' '; } print ''; $accountlinestatic->rowid=$objp->rowid; if ($accountlinestatic->rowid) { print $accountlinestatic->getNomUrl(1); } else { print ' '; } print ''; if ($object->statut == 0) { print 'rowid.'">'.img_delete().''; } if ($object->statut == 1 && $objp->statut != 2) { print 'rowid.'">'.img_picto($langs->trans("RejectCheck"),'disable').''; } if ($objp->statut == 2) { print '   '.img_picto($langs->trans('CheckRejected'),'statut8').''; } print '
"; } else { dol_print_error($db); } dol_fiche_end(); } /* * Boutons Actions */ print '
'; /*if ($user->societe_id == 0 && count($accounts) == 1 && $action == 'new' && $user->rights->banque->cheque) { print ''.$langs->trans('NewCheckReceipt').''; }*/ if ($user->societe_id == 0 && ! empty($object->id) && $object->statut == 0 && $user->rights->banque->cheque) { print ''.$langs->trans('Valid').''; } if ($user->societe_id == 0 && ! empty($object->id) && $user->rights->banque->cheque) { print ''.$langs->trans('Delete').''; } print '
'; if ($action != 'new') { if ($object->statut == 1) { $filename=dol_sanitizeFileName($object->ref); $filedir=$dir.get_exdir($object->number,0,1,0,$object,'cheque') . dol_sanitizeFileName($object->ref); $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id; $formfile->show_documents('remisecheque', $filename, $filedir, $urlsource, 1, 1); print '
'; } } // conciliate $societestatic=new Societe($db); $chargestatic=new ChargeSociales($db); $memberstatic=new Adherent($db); $paymentstatic=new Paiement($db); $paymentsupplierstatic=new PaiementFourn($db); $paymentvatstatic=new TVA($db); $acct = new Account($db); $acct->fetch($object->account_id); $now=dol_now(); $sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type as type"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; //$sql.= " WHERE rappro=0 AND fk_account=".$acct->id; $sql.= " WHERE fk_account=".$acct->id; $sql.= " AND fk_bordereau = ".$object->id; $sql.= " ORDER BY dateo ASC"; $sql.= " LIMIT 1000"; // Limit to avoid page overload /// ajax adjust value date print ' '; $resql = $db->query($sql); if ($resql) { $var=True; $num = $db->num_rows($resql); print_fiche_titre($langs->trans("Reconciliation").': '.$acct->label.'', '', 'title_bank.png'); print '
'; // Show last bank receipts $nbmax=5; $liste=""; $sql = "SELECT DISTINCT num_releve FROM ".MAIN_DB_PREFIX."bank"; $sql.= " WHERE fk_account=".$acct->id." AND num_releve IS NOT NULL"; $sql.= $db->order("num_releve","DESC"); $sql.= $db->plimit($nbmax+1); print $langs->trans("LastAccountStatements").' : '; $resqlr=$db->query($sql); if ($resqlr) { $numr=$db->num_rows($resqlr); $i=0; $last_ok=0; while (($i < $numr) && ($i < $nbmax)) { $objr = $db->fetch_object($resqlr); if (! $last_ok) { $last_releve = $objr->num_releve; $last_ok=1; } $i++; $liste=''.$objr->num_releve.'   '.$liste; } if ($numr >= $nbmax) $liste="...   ".$liste; print $liste; if ($numr > 0) print '

'; else print ''.$langs->trans("None").'

'; } else { dol_print_error($db); } print '
'; print ''; print ''; print ''; print ''.$langs->trans("InputReceiptNumber").': '; print ''; print '
'; if ($options) { print $langs->trans("EventualyAddCategory").':
'; } print '
'.$langs->trans("ThenCheckLinesAndConciliate").' "'.$langs->trans("Conciliate").'"
'; print '
'; print ''; print ''."\n"; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print "\n"; $i = 0; $toconciliate = 0; while ($i < $num) { $objp = $db->fetch_object($resql); $var=!$var; print "\n"; // Date op print ''; // Date value if (! $objp->rappro && ($user->rights->banque->modifier || $user->rights->banque->consolidate)) { print ''; } else { print ''; } // Type + Number $label=($langs->trans("PaymentType".$objp->type)!="PaymentType".$objp->type)?$langs->trans("PaymentType".$objp->type):$objp->type; // $objp->type is a code if ($label=='SOLD') $label=''; print ''; // Description print ''; if ($objp->amount < 0) { print ''."\n"; } else { print ''."\n"; } if ($objp->rappro) { // If line already reconciliated, we show receipt print ''; } else { // If not already reconciliated $toconciliate++; if ($user->rights->banque->modifier) { print '"; // Show checkbox for conciliation if ($db->jdate($objp->do) <= $now) { print '"; } else { print ''; } } else { print ''; } } print "\n"; $i++; } $db->free($resql); print "
'.$langs->trans("DateOperationShort").''.$langs->trans("DateValueShort").''.$langs->trans("Type").''.$langs->trans("Description").''.$langs->trans("Debit").''.$langs->trans("Credit").''.$langs->trans("Action").''.$langs->trans("ToConciliate").'
'.dol_print_date($db->jdate($objp->do),"day").''."\n"; print ''.dol_print_date($db->jdate($objp->dv),"day").""; print ' '; print ''; print ''; print img_edit_remove() . " "; print ''; print img_edit_add() .""; print ''; print ''; print dol_print_date($db->jdate($objp->dv),"day"); print ''.$label.($objp->num_chq?' '.$objp->num_chq:'').''; $reg=array(); preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parentheses on tente recherche de traduction if ($reg[1] && $langs->trans($reg[1])!=$reg[1]) print $langs->trans($reg[1]); else print $objp->label; print ''; /* * Ajout les liens (societe, company...) */ $newline=1; $links = $acct->get_url($objp->rowid); foreach($links as $key=>$val) { if ($newline == 0) print ' - '; else if ($newline == 1) print '
'; if ($links[$key]['type']=='payment') { $paymentstatic->id=$links[$key]['url_id']; print ' '.$paymentstatic->getNomUrl(2); $newline=0; } elseif ($links[$key]['type']=='payment_supplier') { $paymentsupplierstatic->id=$links[$key]['url_id']; $paymentsupplierstatic->ref=$links[$key]['label']; print ' '.$paymentsupplierstatic->getNomUrl(1); $newline=0; } elseif ($links[$key]['type']=='company') { $societestatic->id=$links[$key]['url_id']; $societestatic->name=$links[$key]['label']; print $societestatic->getNomUrl(1,'',24); $newline=0; } else if ($links[$key]['type']=='sc') { $chargestatic->id=$links[$key]['url_id']; $chargestatic->ref=$links[$key]['url_id']; $chargestatic->lib=$langs->trans("SocialContribution"); print ' '.$chargestatic->getNomUrl(1); } else if ($links[$key]['type']=='payment_sc') { // We don't show anything because there is 1 payment for 1 social contribution and we already show link to social contribution /*print ''; print img_object($langs->trans('ShowPayment'),'payment').' '; print $langs->trans("SocialContributionPayment"); print '';*/ $newline=2; } else if ($links[$key]['type']=='payment_vat') { $paymentvatstatic->id=$links[$key]['url_id']; $paymentvatstatic->ref=$links[$key]['url_id']; $paymentvatstatic->ref=$langs->trans("VATPayment"); print ' '.$paymentvatstatic->getNomUrl(1); } else if ($links[$key]['type']=='banktransfert') { print ''; print img_object($langs->trans('ShowTransaction'),'payment').' '; print $langs->trans("TransactionOnTheOtherAccount"); print ''; } else if ($links[$key]['type']=='member') { print ''; print img_object($langs->trans('ShowMember'),'user').' '; print $links[$key]['label']; print ''; } else { //print ' - '; print ''; if (preg_match('/^\((.*)\)$/i',$links[$key]['label'],$reg)) { // Label generique car entre parentheses. On l'affiche en le traduisant if ($reg[1]=='paiement') $reg[1]='Payment'; print $langs->trans($reg[1]); } else { print $links[$key]['label']; } print ''; $newline=0; } } print '
'.price($objp->amount * -1).'  '.price($objp->amount).''.$objp->num_releve.''; print ''; print img_edit(); print '  '; $now=dol_now(); if ($db->jdate($objp->do) <= $now) { print ''; print img_delete(); print ''; } else { print " "; // On empeche la suppression car le raprochement ne pourra se faire qu'après la date passée et que l'écriture apparaisse bien sur le compte. } print "'; print 'rowid])?' checked':'').'>'; print "'; print $langs->trans("FutureTransaction"); print ' 

\n"; if ($toconciliate) { print '

'; } print "
\n"; } else { dol_print_error($db); } llxFooter(); $db->close();