diff --git a/htdocs/compta/paiement/cheque/fiche.php b/htdocs/compta/paiement/cheque/fiche.php new file mode 100644 index 00000000000..6b1322f8a3a --- /dev/null +++ b/htdocs/compta/paiement/cheque/fiche.php @@ -0,0 +1,329 @@ + + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + */ + +/** + \file htdocs/compta/paiement/fiche.php + \ingroup facture + \brief Onglet paiement d'un paiement client + \remarks Fichier presque identique a fournisseur/paiement/fiche.php + \version $Revision$ +*/ + +require('./pre.inc.php'); +require_once(DOL_DOCUMENT_ROOT.'/paiement.class.php'); +require_once(DOL_DOCUMENT_ROOT ."/includes/modules/facture/modules_facture.php"); +if ($conf->banque->enabled) require_once(DOL_DOCUMENT_ROOT.'/compta/bank/account.class.php'); + +$user->getrights('banque'); + +$langs->load('bills'); +$langs->load('banks'); +$langs->load('companies'); + +$mesg=''; + + +/* + * Actions + */ + +if ($_GET['action'] == 'create' && $_GET["accountid"] > 0 && $user->rights->banque) +{ + $remise = new RemiseCheque($db); + $result = $remise->Create($user, $_GET["accountid"]); + if ($result === 0) + { + Header("Location: index.php"); + exit; + } + else + { + $mesg='
| '.$langs->trans("Date")." | \n"; + print ''.$langs->trans("CheckTransmitter")." | \n"; + print ''.$langs->trans("Amount")." | \n"; + print "
| '.dolibarr_print_date($value["date"]).' | '; + print ''.stripslashes($value["emetteur"])." | \n"; + print ''.price($value["amount"]).' | '; + print '
| '.$langs->trans('Numero').' | '.$remise->number.' |
| '.$langs->trans('Date').' | '.dolibarr_print_date($remise->date_bordereau).' |
| '.$langs->trans('Account').' | '; + print ''.img_object($langs->trans("ShowAccount"),'account').' '.$remise->account_label.''; + + print ' |
| '.dolibarr_print_date($objp->dp).' | '; + print ''.$langs->trans("PaymentTypeShort".$objp->paiement_code).' '.$objp->num_paiement.' | '; + print ''.price($objp->amount).' | '; + print ''.stripslashes($objp->banque).' | '; + print ''.stripslashes($objp->emetteur).' | '; + print '
| '; + print ' | '.$langs->trans("Total").' | '; + print ''.price($total).' | '; + print ''; + print ' | '; + print ' |
';
+
+$sql = "SELECT bc.rowid,".$db->pdate("bc.date_bordereau")." as db, bc.amount,";
+$sql.= " bc.statut, ba.label, ba.rowid as bid";
+$sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc";
+$sql.= ",".MAIN_DB_PREFIX."bank_account as ba";
+$sql.= " WHERE ba.rowid=bc.fk_bank_account";
+$sql.= " ORDER BY bc.rowid DESC LIMIT 10;";
+
+$resql = $db->query($sql);
+
+if ($resql)
+{
+ $i = 0;
+
+ print '
| \n";
+print '';
+
+$page=$_GET["page"];
+$sortorder=$_GET["sortorder"];
+$sortfield=$_GET["sortfield"];
+
+$limit = $conf->liste_limit;
+$offset = $limit * $page ;
+if (! $sortorder) $sortorder="DESC";
+if (! $sortfield) $sortfield="p.rowid";
+
+$sql = "SELECT b.amount,b.emetteur,".$db->pdate("b.dateo")." as date,";
+$sql.= " c.code as paiement_code,";
+$sql.= " ba.rowid as bid, ba.label";
+$sql.= " FROM ".MAIN_DB_PREFIX."c_paiement as c";
+$sql.= ",".MAIN_DB_PREFIX."bank as b";
+$sql.= ",".MAIN_DB_PREFIX."bank_account as ba";
+$sql.= " WHERE c.code = 'CHQ' AND c.code = b.fk_type AND b.fk_bordereau = 0 AND b.fk_account = ba.rowid";
+$sql.= " AND b.amount > 0";
+//$sql .= " ORDER BY $sortfield $sortorder";
+$sql .= $db->plimit( $limit+1 ,$offset);
+//print "$sql";
+
+$resql = $db->query($sql);
+
+if ($resql)
+{
+ $num = $db->num_rows($resql);
+ $i = 0;
+
+ $paramlist=($_GET["orphelins"]?"&orphelins=1":"");
+
+ print '
|
| '.img_object($langs->trans("ShowPayment"),"payment").''; + + print ' '.$objp->rowid.' | '; + + print ''.dolibarr_print_date($objp->dp).' | '; + //print ''.$objp->paiement_type.' '.$objp->num_paiement.' | '; + print ''.$langs->trans("PaymentTypeShort".$objp->paiement_code).' '.$objp->num_paiement.' | '; + print ''; + if ($objp->bid) print ''.img_object($langs->trans("ShowAccount"),'account').' '.$objp->label.''; + else print ' '; + print ' | '; + print ''.price($objp->amount).' | '; + print ''; + + if ($objp->statut == 0) + { + print ''.$langs->trans("ToValidate").''; + } + else + { + print img_tick(); + } + + print ' |