Qual: A lot of screen more clear

This commit is contained in:
Laurent Destailleur 2010-02-10 17:07:25 +00:00
parent 3d9e26df4f
commit 8e78f75be4
13 changed files with 337 additions and 297 deletions

View File

@ -346,15 +346,16 @@ class ChargeSociales extends CommonObject
/** \class PaiementCharge
* \brief Classe permettant la gestion des paiements des charges
*/
class PaiementCharge
class PaiementCharge extends CommonObject
{
var $db; //!< To store db handler
var $error; //!< To return error code (or message)
var $errors=array(); //!< To return several error codes (or messages)
//var $element='paiementcharge'; //!< Id that identify managed objects
//var $table_element='paiementcharge'; //!< Name of table without prefix where object is stored
var $element='paiementcharge'; //!< Id that identify managed objects
var $table_element='paiementcharge'; //!< Name of table without prefix where object is stored
var $id;
var $ref;
var $fk_charge;
var $datec='';
@ -463,7 +464,6 @@ class PaiementCharge
global $langs;
$sql = "SELECT";
$sql.= " t.rowid,";
$sql.= " t.fk_charge,";
$sql.= " t.datec,";
$sql.= " t.tms,";
@ -475,10 +475,10 @@ class PaiementCharge
$sql.= " t.fk_bank,";
$sql.= " t.fk_user_creat,";
$sql.= " t.fk_user_modif,";
$sql.= " pt.code as type_code, pt.libelle as type_libelle";
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as t, ".MAIN_DB_PREFIX."c_paiement as pt";
$sql.= " pt.code as type_code, pt.libelle as type_libelle,";
$sql.= ' b.fk_account';
$sql.= " FROM (".MAIN_DB_PREFIX."paiementcharge as t, ".MAIN_DB_PREFIX."c_paiement as pt)";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid';
$sql.= " WHERE t.rowid = ".$id." AND t.fk_typepaiement = pt.id";
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
@ -490,6 +490,7 @@ class PaiementCharge
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
$this->ref = $obj->rowid;
$this->fk_charge = $obj->fk_charge;
$this->datec = $this->db->jdate($obj->datec);
@ -505,6 +506,9 @@ class PaiementCharge
$this->type_code = $obj->type_code;
$this->type_libelle = $obj->type_libelle;
$this->bank_account = $obj->fk_account;
$this->bank_line = $obj->fk_bank;
}
$this->db->free($resql);

View File

@ -23,7 +23,7 @@
/**
* \file htdocs/compta/bank/account.php
* \ingroup banque
* \brief Page de d<EFBFBD>tail des transactions bancaires
* \brief List of detail of bank transaction for an account
* \version $Id$
*/
@ -500,28 +500,18 @@ if ($account || $_GET["ref"])
$links = $acct->get_url($objp->rowid);
$isbanktransfert=false;
foreach($links as $key=>$val) { if ($val['type']=='banktransfert') $isbanktransfert=true; }
$issocialcontrib=false;
foreach($links as $key=>$val) { if ($val['type']=='sc') $issocialcontrib=true; }
$showlabel=true;
//if (sizeof($links) == 0) $showlabel=true;
//if ($isbanktransfert || $issocialcontrib) $showlabel=true;
if ($showlabel)
// Sgow generic description
if (preg_match('/^\((.*)\)$/i',$objp->label,$reg))
{
if (preg_match('/^\((.*)\)$/i',$objp->label,$reg))
{
// Genereic description because between (). We show it after translating.
print $langs->trans($reg[1]);
}
else
{
print dol_trunc($objp->label,60);
}
// Generic description because between (). We show it after translating.
print $langs->trans($reg[1]);
}
else
{
print dol_trunc($objp->label,60);
}
// Add links in description field
// Add links after description
foreach($links as $key=>$val)
{
if ($links[$key]['type']=='payment') {
@ -544,12 +534,11 @@ if ($account || $_GET["ref"])
else if ($links[$key]['type']=='payment_sc')
{
//print ' - ';
/*
print '<a href="'.DOL_URL_ROOT.'/compta/sociales/xxx.php?id='.$links[$key]['url_id'].'">';
//print img_object($langs->trans('ShowPayment'),'payment').' ';
print $langs->trans("SocialContributionPayment");
print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/fiche.php?id='.$links[$key]['url_id'].'">';
print ' '.img_object($langs->trans('ShowPayment'),'payment').' ';
//print $langs->trans("SocialContributionPayment");
print '</a>';
*/
}
else if ($links[$key]['type']=='payment_vat')
{

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Xavier DUTOIT <doli@sydesy.com>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -373,7 +373,7 @@ if ($result)
print '</a>';
}
else if ($links[$key]['type']=='payment_sc') {
print '<a href="'.DOL_URL_ROOT.'/compta/sociales/xxx.php?id='.$links[$key]['url_id'].'">';
print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/fiche.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowPayment'),'payment').' ';
print $langs->trans("SocialContributionPayment");
print '</a>';

View File

@ -187,7 +187,9 @@ if ($resql)
// Date
print '<td align="left" nowrap="nowrap">'.dol_print_date($db->jdate($objp->do),"day")." &nbsp; </td>\n";
// Description
print "<td><a href=\"ligne.php?rowid=$objp->rowid&amp;account=$objp->fk_account\">";
//print $objp->label;
$reg=array();
preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parenthee on tente recherche de traduction
if ($reg[1] && $langs->trans($reg[1])!=$reg[1]) print $langs->trans($reg[1]);

View File

@ -280,7 +280,7 @@ if ($_GET['action'] == 'create' || $_POST['action'] == 'confirm_paiement' || $_P
print '<tr><td><span class="fieldrequired">'.$langs->trans('Date').'</span></td><td>';
$datepayment = dol_mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
$datepayment= ($datepayment == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0) : $datepayment);
$html->select_date($datepayment,'','','',0,"add_paiement");
$html->select_date($datepayment,'','','',0,"add_paiement",1,1);
print '</td>';
print '<td>'.$langs->trans('Comments').'</td></tr>';

View File

@ -226,9 +226,10 @@ if ($resql)
print '<br><table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('Bill').'</td>';
print '<td align="center">'.$langs->trans('Status').'</td>';
print '<td>'.$langs->trans('Company').'</td>';
print '<td align="right">'.$langs->trans('AmountTTC').'</td>';
print '<td align="right">'.$langs->trans('ExpectedToPay').'</td>';
print '<td align="center">'.$langs->trans('Status').'</td>';
print '<td align="right">'.$langs->trans('PayedByThisPayment').'</td>';
print "</tr>\n";
if ($num > 0)
@ -242,15 +243,27 @@ if ($resql)
$objp = $db->fetch_object($resql);
$var=!$var;
print '<tr '.$bc[$var].'>';
// Invoice
print '<td>';
$facturestatic->id=$objp->facid;
$facturestatic->ref=$objp->facnumber;
$facturestatic->type=$objp->type;
print $facturestatic->getNomUrl(1);
print "</td>\n";
print '<td align="center">'.$facturestatic->LibStatut($objp->paye,$objp->fk_statut,2,1).'</td>';
// Third party
print '<td><a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$objp->socid.'">'.img_object($langs->trans('ShowCompany'),'company').' '.$objp->nom.'</a></td>';
// Expected to pay
print '<td align="right">'.price($objp->total_ttc).'</td>';
// Statut
print '<td align="center">'.$facturestatic->LibStatut($objp->paye,$objp->fk_statut,2,1).'</td>';
// Amount payed
print '<td align="right">'.price($objp->amount).'</td>';
print "</tr>\n";
if ($objp->paye == 1) // If at least one invoice is paid, disable delete
{

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@ -17,11 +17,11 @@
*/
/**
\file htdocs/compta/paiement_charge.php
\ingroup compta
\brief Page de creation d'un paiement d'une charge
\version $Id$
*/
* \file htdocs/compta/paiement_charge.php
* \ingroup tax
* \brief Page to add payment of a tax
* \version $Id$
*/
include_once("./pre.inc.php");
include_once(DOL_DOCUMENT_ROOT."/chargesociales.class.php");
@ -34,8 +34,8 @@ $chid=isset($_GET["id"])?$_GET["id"]:$_POST["id"];
// Securite acces client
if ($user->societe_id > 0)
{
$action = '';
$socid = $user->societe_id;
$action = '';
$socid = $user->societe_id;
}
@ -46,98 +46,99 @@ if ($_POST["action"] == 'add_paiement')
{
if ($_POST["cancel"])
{
$loc = DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$chid;
Header("Location: $loc");
$loc = DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$chid;
Header("Location: $loc");
exit;
}
$datepaye = dol_mktime(12, 0 , 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
$datepaye = dol_mktime(12, 0 , 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
if (! $_POST["paiementtype"] > 0)
{
$mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode"));
$error++;
}
if (! $_POST["paiementtype"] > 0)
{
$mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode"));
$error++;
}
if ($datepaye == '')
{
$mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("Date"));
$error++;
}
{
$mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("Date"));
$error++;
}
if (! $error)
{
$paiement_id = 0;
if (! $error)
{
$paiement_id = 0;
// Read possible payments
$amounts = array();
foreach ($_POST as $key => $value)
{
if (substr($key,0,7) == 'amount_')
{
$other_chid = substr($key,7);
// Read possible payments
$amounts = array();
foreach ($_POST as $key => $value)
{
if (substr($key,0,7) == 'amount_')
{
$other_chid = substr($key,7);
$amounts[$other_chid] = $_POST[$key];
}
}
$amounts[$other_chid] = $_POST[$key];
}
}
$db->begin();
$db->begin();
// Creation de la ligne paiement
$paiement = new PaiementCharge($db);
$paiement->chid = $chid;
$paiement->datepaye = $datepaye;
$paiement->amounts = $amounts; // Tableau de montant
$paiement->paiementtype = $_POST["paiementtype"];
$paiement->num_paiement = $_POST["num_paiement"];
$paiement->note = $_POST["note"];
$paiement_id = $paiement->create($user);
// Creation de la ligne paiement
$paiement = new PaiementCharge($db);
$paiement->chid = $chid;
$paiement->datepaye = $datepaye;
$paiement->amounts = $amounts; // Tableau de montant
$paiement->paiementtype = $_POST["paiementtype"];
$paiement->num_paiement = $_POST["num_paiement"];
$paiement->note = $_POST["note"];
$paiement_id = $paiement->create($user);
if ($paiement_id > 0)
{
// On determine le montant total du paiement
$total=0;
foreach ($paiement->amounts as $key => $value)
{
$chid = $key;
$value = trim($value);
$amount = price2num(trim($value), 'MT'); // Un round est ok si nb avec '.'
$total += $amount;
}
if ($paiement_id > 0)
{
// On determine le montant total du paiement
$total=0;
foreach ($paiement->amounts as $key => $value)
{
$chid = $key;
$value = trim($value);
$amount = price2num(trim($value), 'MT'); // Un round est ok si nb avec '.'
$total += $amount;
}
// Insertion dans llx_bank
$langs->load("banks");
// Insertion dans llx_bank
$langs->load("banks");
$label = $langs->transnoentities("SocialContributionPayment");
$acc = new Account($db, $_POST["accountid"]);
$bank_line_id = $acc->addline($paiement->datepaye, $paiement->paiementtype, $label, -abs($total), $paiement->num_paiement, '', $user);
$acc = new Account($db, $_POST["accountid"]);
$bank_line_id = $acc->addline($paiement->datepaye, $paiement->paiementtype, $label, -abs($total), $paiement->num_paiement, '', $user);
// Mise a jour fk_bank dans llx_paiementcharge. On connait ainsi le paiement qui a g<>n<EFBFBD>r<EFBFBD> l'<27>criture bancaire
if ($bank_line_id > 0)
{
$paiement->update_fk_bank($bank_line_id);
// Mise a jour fk_bank dans llx_paiementcharge. On connait ainsi le paiement qui a genere l'ecriture bancaire
if ($bank_line_id > 0)
{
$paiement->update_fk_bank($bank_line_id);
// Mise a jour liens (pour chaque charge concern<72>e par le paiement)
foreach ($paiement->amounts as $key => $value)
{
$acc->add_url_line($bank_line_id, $chid, DOL_URL_ROOT.'/compta/sociales/charges.php?id=', '(socialcontribution)','sc');
}
// Mise a jour liens (pour chaque charge concernee par le paiement)
foreach ($paiement->amounts as $key => $value)
{
//$acc->add_url_line($bank_line_id, $chid, DOL_URL_ROOT.'/compta/charges.php?id=', '(socialcontribution)','payment_sc');
$acc->add_url_line($bank_line_id, $paymentid, DOL_URL_ROOT.'/compta/payment_sc/fiche.php?id=', '(paiement)','payment_sc');
}
$db->commit();
$db->commit();
$loc = DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$chid;
Header("Location: $loc");
exit;
}
else {
$db->rollback();
$mesg = "Echec de la cr<63>ation entr<74>e compte: ".$db->error();
}
}
else
{
$db->rollback();
$mesg = "Echec de la cr<63>ation du paiement: paiement_id=$paiement_id ".$db->error();
}
}
$loc = DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$chid;
Header("Location: $loc");
exit;
}
else {
$db->rollback();
$mesg = "Echec de la creation entree compte: ".$db->error();
}
}
else
{
$db->rollback();
$mesg = "Failed to create payment: paiement_id=$paiement_id ".$db->error();
}
}
$_GET["action"]='create';
}
@ -158,171 +159,175 @@ $html=new Form($db);
if ($_GET["action"] == 'create')
{
$charge = new ChargeSociales($db);
$charge->fetch($chid);
$charge = new ChargeSociales($db);
$charge->fetch($chid);
$total = $charge->amount;
$total = $charge->amount;
print_fiche_titre($langs->trans("DoPayment"));
print "<br>\n";
print_fiche_titre($langs->trans("DoPayment"));
print "<br>\n";
if ($mesg)
{
print "<div class=\"error\">$mesg</div>";
}
print '<form name="add_paiement" action="paiement_charge.php" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"id\" value=\"$charge->id\">";
print '<input type="hidden" name="action" value="add_paiement">';
print '<form name="add_paiement" action="paiement_charge.php" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"id\" value=\"$charge->id\">";
print '<input type="hidden" name="action" value="add_paiement">';
print '<table cellspacing="0" class="border" width="100%" cellpadding="2">';
print '<table cellspacing="0" class="border" width="100%" cellpadding="2">';
print "<tr class=\"liste_titre\"><td colspan=\"3\">Charge</td>";
print "<tr class=\"liste_titre\"><td colspan=\"3\">Charge</td>";
print '<tr><td>'.$langs->trans("Ref").'</td><td colspan="2">';
print '<a href="'.DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$chid.'">'.$chid.'</a></td></tr>';
print '<tr><td>'.$langs->trans("Type")."</td><td colspan=\"2\">".$charge->type_libelle."</td></tr>\n";
print '<tr><td>'.$langs->trans("Period")."</td><td colspan=\"2\">".dol_print_date($charge->periode,'day')."</td></tr>\n";
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$charge->lib."</td></tr>\n";
print '<tr><td>'.$langs->trans("DateDue")."</td><td colspan=\"2\">".dol_print_date($charge->date_ech,'day')."</td></tr>\n";
print '<tr><td>'.$langs->trans("Ref").'</td><td colspan="2">';
print '<a href="'.DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$chid.'">'.$chid.'</a></td></tr>';
print '<tr><td>'.$langs->trans("Type")."</td><td colspan=\"2\">".$charge->type_libelle."</td></tr>\n";
print '<tr><td>'.$langs->trans("Period")."</td><td colspan=\"2\">".dol_print_date($charge->periode,'day')."</td></tr>\n";
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$charge->lib."</td></tr>\n";
print '<tr><td>'.$langs->trans("DateDue")."</td><td colspan=\"2\">".dol_print_date($charge->date_ech,'day')."</td></tr>\n";
print '<tr><td>'.$langs->trans("AmountTTC")."</td><td colspan=\"2\"><b>".price($charge->amount).'</b> '.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
print '<tr><td>'.$langs->trans("AmountTTC")."</td><td colspan=\"2\"><b>".price($charge->amount).'</b> '.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
$sql = "SELECT sum(p.amount) as total";
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
$sql.= " WHERE p.fk_charge = ".$chid;
$resql = $db->query($sql);
if ($resql)
{
$obj=$db->fetch_object($resql);
$sumpaid = $obj->total;
$db->free();
}
print '<tr><td>'.$langs->trans("AlreadyPaid").'</td><td colspan="2"><b>'.price($sumpaid).'</b> '.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
print "<tr><td valign=\"top\">".$langs->trans("RemainderToPay")."</td><td colspan=\"3\"><b>".price($total - $sumpaid).'</b> '.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
$sql = "SELECT sum(p.amount) as total";
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
$sql.= " WHERE p.fk_charge = ".$chid;
$resql = $db->query($sql);
if ($resql)
{
$obj=$db->fetch_object($resql);
$sumpaid = $obj->total;
$db->free();
}
print '<tr><td>'.$langs->trans("AlreadyPaid").'</td><td colspan="2"><b>'.price($sumpaid).'</b> '.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
print "<tr><td valign=\"top\">".$langs->trans("RemainderToPay")."</td><td colspan=\"3\"><b>".price($total - $sumpaid).'</b> '.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
print "<tr class=\"liste_titre\"><td colspan=\"3\">".$langs->trans("Payment").'</td>';
print "<tr class=\"liste_titre\"><td colspan=\"3\">".$langs->trans("Payment").'</td>';
print "<input type=\"hidden\" name=\"chid\" value=\"$chid\">";
print "<input type=\"hidden\" name=\"chid\" value=\"$chid\">";
print '<tr><td>'.$langs->trans("Date").'</td><td>';
$datepayment=empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
$html->select_date($datepayment,'','','','',"add_paiement");
print "</td>";
print '<td>'.$langs->trans("Comments").'</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("Date").'</td><td>';
$datepayment=empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
$html->select_date($datepayment,'','','','',"add_paiement",1,1);
print "</td>";
print '<td>'.$langs->trans("Comments").'</td></tr>';
print '<tr><td>'.$langs->trans("PaymentMode").'</td><td>';
$html->select_types_paiements($charge->paiementtype, "paiementtype");
print "</td>\n";
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
$html->select_types_paiements($charge->paiementtype, "paiementtype");
print "</td>\n";
print '<td rowspan="3" valign="top"><textarea name="comment" wrap="soft" cols="40" rows="'.ROWS_3.'"></textarea></td></tr>';
print '<td rowspan="3" valign="top"><textarea name="comment" wrap="soft" cols="40" rows="'.ROWS_3.'"></textarea></td></tr>';
print '<tr>';
print '<td>'.$langs->trans('AccountToCredit').'</td>';
print '<td>';
$html->select_comptes($charge->accountid, "accountid", 0, "courant=1"); // Affiche liste des comptes courant
print '</td></tr>';
print '<tr>';
print '<td class="fieldrequired">'.$langs->trans('AccountToCredit').'</td>';
print '<td>';
$html->select_comptes($charge->accountid, "accountid", 0, "courant=1"); // Affiche liste des comptes courant
print '</td></tr>';
print '<tr><td>'.$langs->trans('Numero');
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
print "<td><input name=\"num_paiement\" type=\"text\"></td></tr>\n";
print '<tr><td>'.$langs->trans('Numero');
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
print "<td><input name=\"num_paiement\" type=\"text\"></td></tr>\n";
/*
* Autres charges impay<EFBFBD>es
*/
$num = 1;
$i = 0;
print '<tr><td colspan="3">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
//print '<td>'.$langs->trans("SocialContribution").'</td>';
print '<td align="left">'.$langs->trans("DateDue").'</td>';
print '<td align="right">'.$langs->trans("AmountTTC").'</td>';
print '<td align="right">'.$langs->trans("AlreadyPaid").'</td>';
print '<td align="right">'.$langs->trans("RemainderToPay").'</td>';
print '<td align="right">'.$langs->trans("Amount").'</td>';
print "</tr>\n";
/*
* Autres charges impayees
*/
$num = 1;
$i = 0;
print '<tr><td colspan="3">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
//print '<td>'.$langs->trans("SocialContribution").'</td>';
print '<td align="left">'.$langs->trans("DateDue").'</td>';
print '<td align="right">'.$langs->trans("AmountTTC").'</td>';
print '<td align="right">'.$langs->trans("AlreadyPaid").'</td>';
print '<td align="right">'.$langs->trans("RemainderToPay").'</td>';
print '<td align="right">'.$langs->trans("Amount").'</td>';
print "</tr>\n";
$var=True;
$total=0;
$totalrecu=0;
$var=True;
$total=0;
$totalrecu=0;
while ($i < $num)
{
//$objp = $db->fetch_object($result);
$objp = $charge;
while ($i < $num)
{
//$objp = $db->fetch_object($result);
$objp = $charge;
$var=!$var;
$var=!$var;
print "<tr $bc[$var]>";
print "<tr $bc[$var]>";
//print '<td>'.$charge->getNomUrl(1)."</td>\n";
//print '<td>'.$charge->getNomUrl(1)."</td>\n";
if ($objp->date_ech > 0)
{
print "<td align=\"left\">".dol_print_date($objp->date_ech,'day')."</td>\n";
}
else
{
print "<td align=\"center\"><b>!!!</b></td>\n";
}
if ($objp->date_ech > 0)
{
print "<td align=\"left\">".dol_print_date($objp->date_ech,'day')."</td>\n";
}
else
{
print "<td align=\"center\"><b>!!!</b></td>\n";
}
print '<td align="right">'.price($objp->amount)."</td>";
print '<td align="right">'.price($objp->amount)."</td>";
print '<td align="right">'.price($sumpaid)."</td>";
print '<td align="right">'.price($sumpaid)."</td>";
print '<td align="right">'.price($objp->amount-$sumpaid)."</td>";
print '<td align="right">'.price($objp->amount-$sumpaid)."</td>";
print '<td align="right">';
if ($sumpaid < $objp->amount)
{
$namef = "amount_".$objp->id;
print '<input type="text" size="8" name="'.$namef.'">';
}
else
{
print '-';
}
print "</td>";
print '<td align="right">';
if ($sumpaid < $objp->amount)
{
$namef = "amount_".$objp->id;
print '<input type="text" size="8" name="'.$namef.'">';
}
else
{
print '-';
}
print "</td>";
print "</tr>\n";
$total+=$objp->total;
$total_ttc+=$objp->total_ttc;
$totalrecu+=$objp->am;
$i++;
}
if ($i > 1)
{
// Print total
print "<tr ".$bc[!$var].">";
print '<td colspan="2" align="left">'.$langs->trans("TotalTTC").':</td>';
print "<td align=\"right\"><b>".price($total_ttc)."</b></td>";
print "<td align=\"right\"><b>".price($totalrecu)."</b></td>";
print "<td align=\"right\"><b>".price($total_ttc - $totalrecu)."</b></td>";
print '<td align="center">&nbsp;</td>';
print "</tr>\n";
}
print "</table></td></tr>\n";
// }
// $db->free();
// }
// else
// {
// print $sql ."<br>".$db->error();
// }
/*
*
*/
print "</tr>\n";
$total+=$objp->total;
$total_ttc+=$objp->total_ttc;
$totalrecu+=$objp->am;
$i++;
}
if ($i > 1)
{
// Print total
print "<tr ".$bc[!$var].">";
print '<td colspan="2" align="left">'.$langs->trans("TotalTTC").':</td>';
print "<td align=\"right\"><b>".price($total_ttc)."</b></td>";
print "<td align=\"right\"><b>".price($totalrecu)."</b></td>";
print "<td align=\"right\"><b>".price($total_ttc - $totalrecu)."</b></td>";
print '<td align="center">&nbsp;</td>';
print "</tr>\n";
}
print "</table></td></tr>\n";
// }
// $db->free();
// }
// else
// {
// print $sql ."<br>".$db->error();
// }
/*
*
*/
print '<tr><td colspan="3" align="center">';
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
print '&nbsp; &nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</td></tr>';
print "</table>";
print "</form>\n";
// }
print "</table>";
print '<br><center>';
//print '<tr><td colspan="3" align="center">';
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
print '&nbsp; &nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</center>';
//print '</td></tr>';
print "</form>\n";
// }
}

View File

@ -28,7 +28,6 @@
*/
require('./pre.inc.php');
require_once(DOL_DOCUMENT_ROOT.'/paiement.class.php');
include_once(DOL_DOCUMENT_ROOT."/chargesociales.class.php");
require_once(DOL_DOCUMENT_ROOT.'/facture.class.php');
require_once(DOL_DOCUMENT_ROOT."/includes/modules/facture/modules_facture.php");
@ -56,7 +55,7 @@ if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes' &&
{
$db->begin();
$paiement = new Paiement($db);
$paiement = new PaiementCharge($db);
$paiement->fetch($_GET['id']);
$result = $paiement->delete();
if ($result > 0)
@ -76,7 +75,7 @@ if ($_REQUEST['action'] == 'confirm_valide' && $_REQUEST['confirm'] == 'yes' &&
{
$db->begin();
$paiement = new Paiement($db);
$paiement = new PaiementCharge($db);
$paiement->id = $_GET['id'];
if ($paiement->valide() > 0)
{
@ -166,7 +165,10 @@ if ($mesg) print $mesg.'<br>';
print '<table class="border" width="100%">';
// Ref
print '<tr><td valign="top" width="140">'.$langs->trans('Ref').'</td><td colspan="3">'.$paiement->id.'</td></tr>';
print '<tr><td valign="top" width="140">'.$langs->trans('Ref').'</td>';
print '<td colspan="3">';
print $html->showrefnav($paiement,'id','',1,'rowid','id');
print '</td></tr>';
// Date
print '<tr><td valign="top" width="120">'.$langs->trans('Date').'</td><td colspan="3">'.dol_print_date($paiement->datep,'day').'</td></tr>';
@ -205,11 +207,11 @@ print '</table>';
/*
* List of invoices
* List of social contributions payed
*/
$disable_delete = 0;
$sql = 'SELECT f.rowid as scid, f.libelle, f.paye, pf.amount, pc.libelle as sc_type';
$sql = 'SELECT f.rowid as scid, f.libelle, f.paye, f.amount as sc_amount, pf.amount, pc.libelle as sc_type';
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiementcharge as pf,'.MAIN_DB_PREFIX.'chargesociales as f, '.MAIN_DB_PREFIX.'c_chargesociales as pc';
$sql.= ' WHERE pf.fk_charge = f.rowid AND pf.fk_typepaiement = pc.id';
$sql.= ' AND f.entity = '.$conf->entity;
@ -225,8 +227,9 @@ if ($resql)
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('SocialContribution').'</td>';
print '<td>'.$langs->trans('Label').'</td>';
print '<td align="right">'.$langs->trans('ExpectedToPay').'</td>';
print '<td align="center">'.$langs->trans('Status').'</td>';
print '<td align="right">'.$langs->trans('AmountTTC').'</td>';
print '<td align="right">'.$langs->trans('PayedByThisPayment').'</td>';
print "</tr>\n";
if ($num > 0)
@ -247,7 +250,11 @@ if ($resql)
print $socialcontribstatic->getNomUrl(1);
print "</td>\n";
print '<td>'.$objp->libelle.'</td>';
// Expected to pay
print '<td align="right">'.price($objp->sc_amount).'</td>';
// Status
print '<td align="center">'.$socialcontribstatic->LibStatut($objp->fk_statut,2).'</td>';
// Amount payed
print '<td align="right">'.price($objp->amount).'</td>';
print "</tr>\n";
if ($objp->paye == 1) // If at least one invoice is paid, disable delete

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
*
@ -232,11 +232,11 @@ if ($action == 'create' || $action == 'add_paiement')
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans('Payment').'</td>';
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="2">'.$obj->nom.'</td></tr>';
print '<tr><td>'.$langs->trans('Date').'</td><td>';
$html->select_date($dateinvoice,'','','','',"addpaiement");
print '<tr><td class="fieldrequired">'.$langs->trans('Date').'</td><td>';
$html->select_date($dateinvoice,'','','','',"addpaiement",1,1);
print '</td>';
print '<td>'.$langs->trans('Comments').'</td></tr>';
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>';
print '<tr><td class="fieldrequired">'.$langs->trans('PaymentMode').'</td><td>';
$html->select_types_paiements(empty($_POST['paiementid'])?'':$_POST['paiementid'],'paiementid');
print '</td>';
print '<td rowspan="3" valign="top">';
@ -244,7 +244,7 @@ if ($action == 'create' || $action == 'add_paiement')
print '<tr><td>'.$langs->trans('Numero').'</td><td><input name="num_paiement" type="text" value="'.(empty($_POST['num_paiement'])?'':$_POST['num_paiement']).'"></td></tr>';
if ($conf->banque->enabled)
{
print '<tr><td>'.$langs->trans('Account').'</td><td>';
print '<tr><td class="fieldrequired">'.$langs->trans('Account').'</td><td>';
$html->select_comptes(empty($_POST['accountid'])?'':$_POST['accountid'],'accountid',0,'',1);
print '</td></tr>';
}
@ -252,6 +252,8 @@ if ($action == 'create' || $action == 'add_paiement')
{
print '<tr><td colspan="2">&nbsp;</td></tr>';
}
print '</table>';
/*
* Autres factures impayees
*/
@ -270,7 +272,8 @@ if ($action == 'create' || $action == 'add_paiement')
if ($num > 0)
{
$i = 0;
print '<tr><td colspan="3">';
print '<br>';
print $langs->trans('Invoices').'<br>';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -326,7 +329,7 @@ if ($action == 'create' || $action == 'add_paiement')
print '<td align="center">&nbsp;</td>';
print "</tr>\n";
}
print "</table></td></tr>\n";
print "</table>\n";
}
$db->free($resql);
}
@ -338,8 +341,10 @@ if ($action == 'create' || $action == 'add_paiement')
/*
*
*/
print '<tr><td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans('Save').'"></td></tr>';
print '</table>';
print '<br>';
print '<center><input type="submit" class="button" value="'.$langs->trans('Save').'"></center>';
print '</form>';
}
}

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@ -156,24 +156,6 @@ print '<table class="border" width="100%">';
print '<tr>';
print '<td valign="top" width="140" colspan="2">'.$langs->trans('Ref').'</td><td colspan="3">'.$paiement->id.'</td></tr>';
if ($conf->banque->enabled)
{
if ($paiement->bank_account)
{
// Si compte renseign<67>, on affiche libelle
$bank=new Account($db);
$bank->fetch($paiement->bank_account);
$bankline=new AccountLine($db);
$bankline->fetch($paiement->bank_line);
print '<tr>';
print '<td valign="top" width="140" colspan="2">'.$langs->trans('BankAccount').'</td>';
print '<td><a href="'.DOL_URL_ROOT.'/compta/bank/account.php?account='.$bank->id.'">'.img_object($langs->trans('ShowAccount'),'account').' '.$bank->label.'</a></td>';
print '<td>'.$langs->trans('BankLineConciliated').'</td><td>'.yn($bankline->rappro).'</td>';
print '</tr>';
}
}
//switch through edition options for date (only available when statut is -not 1- (=validated))
if (empty($_GET['action']) || $_GET['action']!='edit_date')
@ -242,6 +224,25 @@ if ($conf->global->BILL_ADD_PAYMENT_VALIDATION)
print '<tr><td valign="top" colspan="2">'.$langs->trans('Status').'</td><td colspan="3">'.$paiement->getLibStatut(4).'</td></tr>';
}
if ($conf->banque->enabled)
{
if ($paiement->bank_account)
{
// Si compte renseigne, on affiche libelle
$bank=new Account($db);
$bank->fetch($paiement->bank_account);
$bankline=new AccountLine($db);
$bankline->fetch($paiement->bank_line);
print '<tr>';
print '<td valign="top" width="140" colspan="2">'.$langs->trans('BankAccount').'</td>';
print '<td><a href="'.DOL_URL_ROOT.'/compta/bank/account.php?account='.$bank->id.'">'.img_object($langs->trans('ShowAccount'),'account').' '.$bank->label.'</a></td>';
print '<td>'.$langs->trans('BankLineConciliated').'</td><td>'.yn($bankline->rappro).'</td>';
print '</tr>';
}
}
print '<tr><td valign="top" colspan="2">'.$langs->trans('Note').'</td><td colspan="3">'.nl2br($paiement->note).'</td></tr>';
print '</table>';
@ -270,9 +271,10 @@ if ($resql)
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('Ref').'</td>';
print '<td>'.$langs->trans('RefSupplier').'</td>';
print '<td align="center">'.$langs->trans('Status').'</td>';
print '<td>'.$langs->trans('Company').'</td>';
print '<td align="right">'.$langs->trans('AmountTTC').'</td>';
print '<td align="right">'.$langs->trans('ExpectedToPay').'</td>';
print '<td align="center">'.$langs->trans('Status').'</td>';
print '<td align="right">'.$langs->trans('PayedByThisPayment').'</td>';
print "</tr>\n";
if ($num > 0)
@ -286,12 +288,19 @@ if ($resql)
$objp = $db->fetch_object($resql);
$var=!$var;
print '<tr '.$bc[$var].'>';
// Ref
print '<td><a href="'.DOL_URL_ROOT.'/fourn/facture/fiche.php?facid='.$objp->facid.'">'.img_object($langs->trans('ShowBill'),'bill').' ';
print $objp->ref;
print "</a></td>\n";
// Ref supplier
print '<td>'.$objp->ref_supplier."</td>\n";
print '<td align="center">'.$facturestatic->LibStatut($objp->paye,$objp->fk_statut,2,1).'</td>';
// Third party
print '<td><a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$objp->socid.'">'.img_object($langs->trans('ShowCompany'),'company').' '.$objp->nom.'</a></td>';
// Expected to pay
print '<td align="right">'.price($objp->total_ttc).'</td>';
// Status
print '<td align="center">'.$facturestatic->LibStatut($objp->paye,$objp->fk_statut,2,1).'</td>';
// Payed
print '<td align="right">'.price($objp->amount).'</td>';
print "</tr>\n";
if ($objp->paye == 1)

View File

@ -354,6 +354,8 @@ Cash=Cash
Reported=Delayed
DisabledBecausePayments=Not possible since there is some payments
CantRemovePaymentWithOneInvoicePaid=Can't remove payment since there is at least on invoice classified payed
ExpectedToPay=Expected payment
PayedByThisPayment=Payed by this payment
##### Types de contacts #####
TypeContact_facture_internal_SALESREPFOLL=Representative following-up customer invoice
TypeContact_facture_external_BILLING=Customer invoice contact

View File

@ -356,6 +356,8 @@ InvoiceDepositAsk=Facture d'acompte
InvoiceDepositDesc=La <b>facture d'acompte</b> est le type de facture qui fait suite à réception d'un acompte, s'il n'est pas encore possible de saisir le paiement sur une facture définitive.
DisabledBecausePayments=Non disponible car il existe des paiements
CantRemovePaymentWithOneInvoicePaid=Suppression impossible quand il existe au moins une facture classée payée.
ExpectedToPay=Paiement attendu
PayedByThisPayment=Payé par ce paiement
##### Types de contacts #####
TypeContact_facture_internal_SALESREPFOLL=Reponsable suivi facture client
TypeContact_facture_external_BILLING=Contact client facturation

View File

@ -68,9 +68,10 @@ class Paiement
*/
function fetch($id)
{
$sql = 'SELECT p.rowid, p.datep as dp, p.amount, p.statut, p.fk_bank';
$sql.= ', c.code as type_code, c.libelle as type_libelle';
$sql.= ', p.num_paiement, p.note, b.fk_account';
$sql = 'SELECT p.rowid, p.datep as dp, p.amount, p.statut, p.fk_bank,';
$sql.= ' c.code as type_code, c.libelle as type_libelle,';
$sql.= ' p.num_paiement, p.note,';
$sql.= ' b.fk_account';
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiement as p';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid ';
$sql.= ' WHERE p.fk_paiement = c.id';
@ -89,14 +90,15 @@ class Paiement
$this->date = $this->db->jdate($obj->dp);
$this->datepaye = $this->db->jdate($obj->dp);
$this->numero = $obj->num_paiement;
$this->bank_account = $obj->fk_account;
$this->bank_line = $obj->fk_bank;
$this->montant = $obj->amount;
$this->note = $obj->note;
$this->type_libelle = $obj->type_libelle;
$this->type_code = $obj->type_code;
$this->statut = $obj->statut;
$this->bank_account = $obj->fk_account;
$this->bank_line = $obj->fk_bank;
$this->db->free($result);
return 1;
}