forked from Wavyzz/dolibarr
Qual: Uniformizing payments
This commit is contained in:
@@ -245,10 +245,15 @@ if ($conf->tax->enabled)
|
|||||||
// Date payment
|
// Date payment
|
||||||
print '<td align="center">'.dol_print_date($db->jdate($obj->datep),'day').'</td>';
|
print '<td align="center">'.dol_print_date($db->jdate($obj->datep),'day').'</td>';
|
||||||
// Type payment
|
// Type payment
|
||||||
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
|
print '<td>';
|
||||||
|
if ($obj->payment_code) print $langs->trans("PaymentTypeShort".$obj->payment_code).' ';
|
||||||
|
print $obj->num_payment.'</td>';
|
||||||
// Paid
|
// Paid
|
||||||
print '<td align="right">'.price($obj->totalpaye).'</td>';
|
print '<td align="right">';
|
||||||
|
if ($obj->totalpaye) print price($obj->totalpaye);
|
||||||
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$total = $total + $obj->total;
|
$total = $total + $obj->total;
|
||||||
$totalnb = $totalnb + $obj->nb;
|
$totalnb = $totalnb + $obj->nb;
|
||||||
$totalpaye = $totalpaye + $obj->totalpaye;
|
$totalpaye = $totalpaye + $obj->totalpaye;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
*
|
*
|
||||||
@@ -37,13 +37,19 @@ $langs->load('banks');
|
|||||||
$langs->load('companies');
|
$langs->load('companies');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$id=isset($_GET["id"])?$_GET["id"]:$_POST["id"];
|
$id=GETPOST("id");
|
||||||
$action=isset($_GET["action"])?$_GET["action"]:$_POST["action"];
|
$action=GETPOST("action");
|
||||||
|
$confirm=GETPOST('confirm');
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
// TODO ajouter regle pour restreindre acces paiement
|
// TODO ajouter regle pour restreindre acces paiement
|
||||||
//$result = restrictedArea($user, 'facture', $id,'');
|
//$result = restrictedArea($user, 'facture', $id,'');
|
||||||
|
|
||||||
$mesg='';
|
$paiement = new PaymentSocialContribution($db);
|
||||||
|
if ($id > 0)
|
||||||
|
{
|
||||||
|
$result=$paiement->fetch($id);
|
||||||
|
if (! $result) dol_print_error($db,'Failed to get payment id '.$id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -51,12 +57,10 @@ $mesg='';
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Delete payment
|
// Delete payment
|
||||||
if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes' && $user->rights->tax->charges->supprimer)
|
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->tax->charges->supprimer)
|
||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$paiement = new PaymentSocialContribution($db);
|
|
||||||
$paiement->fetch($_REQUEST['id']);
|
|
||||||
$result = $paiement->delete($user);
|
$result = $paiement->delete($user);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
@@ -66,19 +70,19 @@ if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes' &&
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$paiement->error.'</div>';
|
setEventMessage($paiement->error, 'errors');
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create payment
|
// Create payment
|
||||||
if ($_REQUEST['action'] == 'confirm_valide' && $_REQUEST['confirm'] == 'yes' && $user->rights->tax->charges->creer)
|
if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->tax->charges->creer)
|
||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$paiement = new PaymentSocialContribution($db);
|
$result=$paiement->valide();
|
||||||
$paiement->id = $_REQUEST['id'];
|
|
||||||
if ($paiement->valide() > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
|
|
||||||
@@ -102,7 +106,7 @@ if ($_REQUEST['action'] == 'confirm_valide' && $_REQUEST['confirm'] == 'yes' &&
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$paiement->error.'</div>';
|
setEventMessage($paiement->error);
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -115,14 +119,6 @@ if ($_REQUEST['action'] == 'confirm_valide' && $_REQUEST['confirm'] == 'yes' &&
|
|||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
$socialcontrib=new ChargeSociales($db);
|
$socialcontrib=new ChargeSociales($db);
|
||||||
$paiement = new PaymentSocialContribution($db);
|
|
||||||
|
|
||||||
$result=$paiement->fetch($_GET['id']);
|
|
||||||
if ($result <= 0)
|
|
||||||
{
|
|
||||||
dol_print_error($db,'Payment '.$_GET['id'].' not found in database');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
@@ -144,7 +140,7 @@ dol_fiche_head($head, $hselected, $langs->trans("PaymentSocialContribution"), 0,
|
|||||||
/*
|
/*
|
||||||
* Confirmation de la suppression du paiement
|
* Confirmation de la suppression du paiement
|
||||||
*/
|
*/
|
||||||
if ($_GET['action'] == 'delete')
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
print $form->formconfirm('fiche.php?id='.$paiement->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete','',0,2);
|
print $form->formconfirm('fiche.php?id='.$paiement->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete','',0,2);
|
||||||
|
|
||||||
@@ -153,7 +149,7 @@ if ($_GET['action'] == 'delete')
|
|||||||
/*
|
/*
|
||||||
* Confirmation de la validation du paiement
|
* Confirmation de la validation du paiement
|
||||||
*/
|
*/
|
||||||
if ($_GET['action'] == 'valide')
|
if ($action == 'valide')
|
||||||
{
|
{
|
||||||
$facid = $_GET['facid'];
|
$facid = $_GET['facid'];
|
||||||
print $form->formconfirm('fiche.php?id='.$paiement->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2);
|
print $form->formconfirm('fiche.php?id='.$paiement->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2);
|
||||||
@@ -161,9 +157,6 @@ if ($_GET['action'] == 'valide')
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($mesg) print $mesg.'<br>';
|
|
||||||
|
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
@@ -182,8 +175,7 @@ print '<tr><td valign="top">'.$langs->trans('Mode').'</td><td colspan="3">'.$lan
|
|||||||
print '<tr><td valign="top">'.$langs->trans('Numero').'</td><td colspan="3">'.$paiement->num_paiement.'</td></tr>';
|
print '<tr><td valign="top">'.$langs->trans('Numero').'</td><td colspan="3">'.$paiement->num_paiement.'</td></tr>';
|
||||||
|
|
||||||
// Montant
|
// Montant
|
||||||
print '<tr><td valign="top">'.$langs->trans('Amount').'</td><td colspan="3">'.price($paiement->amount).' '.$langs->trans('Currency'.$conf->currency).'</td></tr>';
|
print '<tr><td valign="top">'.$langs->trans('Amount').'</td><td colspan="3">'.price($paiement->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
|
||||||
|
|
||||||
|
|
||||||
// Note
|
// Note
|
||||||
print '<tr><td valign="top">'.$langs->trans('Note').'</td><td colspan="3">'.nl2br($paiement->note).'</td></tr>';
|
print '<tr><td valign="top">'.$langs->trans('Note').'</td><td colspan="3">'.nl2br($paiement->note).'</td></tr>';
|
||||||
@@ -262,7 +254,7 @@ if ($resql)
|
|||||||
// Expected to pay
|
// Expected to pay
|
||||||
print '<td align="right">'.price($objp->sc_amount).'</td>';
|
print '<td align="right">'.price($objp->sc_amount).'</td>';
|
||||||
// Status
|
// Status
|
||||||
print '<td align="center">'.$socialcontrib->getLibStatut(4).'</td>';
|
print '<td align="center">'.$socialcontrib->getLibStatut(4,$objp->amount).'</td>';
|
||||||
// Amount payed
|
// Amount payed
|
||||||
print '<td align="right">'.price($objp->amount).'</td>';
|
print '<td align="right">'.price($objp->amount).'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@@ -323,7 +315,8 @@ if ($_GET['action'] == '')
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
|
$db->close();
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2004-2014 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>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -32,6 +32,7 @@ $langs->load("bills");
|
|||||||
|
|
||||||
$id=GETPOST('id','int');
|
$id=GETPOST('id','int');
|
||||||
$action=GETPOST("action");
|
$action=GETPOST("action");
|
||||||
|
$confirm=GETPOST('confirm');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid = GETPOST('socid','int');
|
$socid = GETPOST('socid','int');
|
||||||
@@ -47,20 +48,16 @@ $result = restrictedArea($user, 'tax', $id, 'chargesociales','charges');
|
|||||||
/* */
|
/* */
|
||||||
/* *************************************************************************** */
|
/* *************************************************************************** */
|
||||||
|
|
||||||
/*
|
// Classify paid
|
||||||
* Classify paid
|
if ($action == 'confirm_paid' && $confirm == 'yes')
|
||||||
*/
|
|
||||||
if ($action == 'confirm_paid' && $_REQUEST["confirm"] == 'yes')
|
|
||||||
{
|
{
|
||||||
$chargesociales = new ChargeSociales($db);
|
$chargesociales = new ChargeSociales($db);
|
||||||
$chargesociales->fetch($id);
|
$chargesociales->fetch($id);
|
||||||
$result = $chargesociales->set_paid($user);
|
$result = $chargesociales->set_paid($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// Delete social contribution
|
||||||
* Delete social contribution
|
if ($action == 'confirm_delete' && $confirm == 'yes')
|
||||||
*/
|
|
||||||
if ($action == 'confirm_delete' && $_REQUEST["confirm"] == 'yes')
|
|
||||||
{
|
{
|
||||||
$chargesociales=new ChargeSociales($db);
|
$chargesociales=new ChargeSociales($db);
|
||||||
$chargesociales->fetch($id);
|
$chargesociales->fetch($id);
|
||||||
@@ -77,10 +74,7 @@ if ($action == 'confirm_delete' && $_REQUEST["confirm"] == 'yes')
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
// Add social contribution
|
||||||
* Add social contribution
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ($action == 'add' && $user->rights->tax->charges->creer)
|
if ($action == 'add' && $user->rights->tax->charges->creer)
|
||||||
{
|
{
|
||||||
$dateech=@dol_mktime($_POST["echhour"],$_POST["echmin"],$_POST["echsec"],$_POST["echmonth"],$_POST["echday"],$_POST["echyear"]);
|
$dateech=@dol_mktime($_POST["echhour"],$_POST["echmin"],$_POST["echsec"],$_POST["echmonth"],$_POST["echday"],$_POST["echyear"]);
|
||||||
@@ -303,8 +297,8 @@ if ($id > 0)
|
|||||||
print '<td rowspan="'.$rowspan.'" valign="top">';
|
print '<td rowspan="'.$rowspan.'" valign="top">';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Paiements
|
* Paiements
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT p.rowid, p.num_paiement, datep as dp, p.amount,";
|
$sql = "SELECT p.rowid, p.num_paiement, datep as dp, p.amount,";
|
||||||
$sql.= "c.libelle as paiement_type";
|
$sql.= "c.libelle as paiement_type";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
|
||||||
@@ -325,7 +319,7 @@ if ($id > 0)
|
|||||||
echo '<table class="nobordernopadding" width="100%">';
|
echo '<table class="nobordernopadding" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Payments").'</td><td>'.$langs->trans("Type").'</td>';
|
print '<td>'.$langs->trans("Payments").'</td><td>'.$langs->trans("Type").'</td>';
|
||||||
print '<td align="right">'.$langs->trans("Amount").'</td><td> </td></tr>';
|
print '<td align="right">'.$langs->trans("Amount").'</td><td> </td></tr>';
|
||||||
|
|
||||||
$var=True;
|
$var=True;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
@@ -336,7 +330,7 @@ if ($id > 0)
|
|||||||
print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/fiche.php?id='.$objp->rowid.'">'.img_object($langs->trans("Payment"),"payment").'</a> ';
|
print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/fiche.php?id='.$objp->rowid.'">'.img_object($langs->trans("Payment"),"payment").'</a> ';
|
||||||
print dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
|
print dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
|
||||||
print "<td>".$objp->paiement_type.' '.$objp->num_paiement."</td>\n";
|
print "<td>".$objp->paiement_type.' '.$objp->num_paiement."</td>\n";
|
||||||
print '<td align="right">'.price($objp->amount)."</td><td> ".$langs->trans("Currency".$conf->currency)."</td>\n";
|
print '<td align="right">'.price($objp->amount)."</td><td> ".$langs->trans("Currency".$conf->currency)."</td>\n";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
$totalpaye += $objp->amount;
|
$totalpaye += $objp->amount;
|
||||||
$i++;
|
$i++;
|
||||||
@@ -363,7 +357,7 @@ if ($id > 0)
|
|||||||
|
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
// Period end date
|
// Period end date
|
||||||
print "<tr><td>".$langs->trans("PeriodEndDate")."</td>";
|
print "<tr><td>".$langs->trans("PeriodEndDate")."</td>";
|
||||||
print "<td>";
|
print "<td>";
|
||||||
if ($action == 'edit')
|
if ($action == 'edit')
|
||||||
@@ -388,10 +382,10 @@ if ($id > 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Amount
|
// Amount
|
||||||
print '<tr><td>'.$langs->trans("AmountTTC").'</td><td>'.price($object->amount).'</td></tr>';
|
print '<tr><td>'.$langs->trans("AmountTTC").'</td><td>'.price($object->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
|
||||||
|
|
||||||
// Status
|
// Status
|
||||||
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
|
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4, $totalpaye).'</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ class ChargeSociales extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->lasterror();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -317,28 +317,31 @@ class ChargeSociales extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retourne le libelle du statut d'une charge (impaye, payee)
|
* Retourne le libelle du statut d'une charge (impaye, payee)
|
||||||
*
|
*
|
||||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
|
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
|
||||||
* @return string Label
|
* @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
|
||||||
|
* @return string Label
|
||||||
*/
|
*/
|
||||||
function getLibStatut($mode=0)
|
function getLibStatut($mode=0,$alreadypayed=-1)
|
||||||
{
|
{
|
||||||
return $this->LibStatut($this->paye,$mode);
|
return $this->LibStatut($this->paye,$mode,$alreadypayed);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renvoi le libelle d'un statut donne
|
* Renvoi le libelle d'un statut donne
|
||||||
*
|
*
|
||||||
* @param int $statut Id statut
|
* @param int $statut Id statut
|
||||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||||
* @return string Label
|
* @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
|
||||||
|
* @return string Label
|
||||||
*/
|
*/
|
||||||
function LibStatut($statut,$mode=0)
|
function LibStatut($statut,$mode=0,$alreadypayed=-1)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
$langs->load('customers');
|
$langs->load('customers');
|
||||||
|
$langs->load('bills');
|
||||||
|
|
||||||
if ($mode == 0)
|
if ($mode == 0)
|
||||||
{
|
{
|
||||||
if ($statut == 0) return $langs->trans("Unpaid");
|
if ($statut == 0) return $langs->trans("Unpaid");
|
||||||
@@ -361,12 +364,14 @@ class ChargeSociales extends CommonObject
|
|||||||
}
|
}
|
||||||
if ($mode == 4)
|
if ($mode == 4)
|
||||||
{
|
{
|
||||||
if ($statut == 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
|
if ($statut == 0 && $alreadypayed <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
|
||||||
|
if ($statut == 0 && $alreadypayed > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
|
||||||
if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
|
if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
|
||||||
}
|
}
|
||||||
if ($mode == 5)
|
if ($mode == 5)
|
||||||
{
|
{
|
||||||
if ($statut == 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
|
if ($statut == 0 && $alreadypayed <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
|
||||||
|
if ($statut == 0 && $alreadypayed > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
|
||||||
if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
|
if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
||||||
@@ -63,7 +63,7 @@ if (! $sortfield) $sortfield="name";
|
|||||||
|
|
||||||
|
|
||||||
$object = new ChargeSociales($db);
|
$object = new ChargeSociales($db);
|
||||||
$object->fetch($id);
|
if ($id > 0) $object->fetch($id);
|
||||||
|
|
||||||
$upload_dir = $conf->tax->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
$upload_dir = $conf->tax->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||||
$modulepart='tax';
|
$modulepart='tax';
|
||||||
@@ -87,6 +87,8 @@ llxHeader("",$langs->trans("SocialContribution"),$help_url);
|
|||||||
|
|
||||||
if ($object->id)
|
if ($object->id)
|
||||||
{
|
{
|
||||||
|
$alreadypayed=$object->getSommePaiement();
|
||||||
|
|
||||||
$head=tax_prepare_head($object, $user);
|
$head=tax_prepare_head($object, $user);
|
||||||
|
|
||||||
dol_fiche_head($head, 'documents', $langs->trans("SocialContribution"), 0, 'bill');
|
dol_fiche_head($head, 'documents', $langs->trans("SocialContribution"), 0, 'bill');
|
||||||
@@ -149,10 +151,10 @@ if ($object->id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Amount
|
// Amount
|
||||||
print '<tr><td>'.$langs->trans("AmountTTC").'</td><td>'.price($object->amount).'</td></tr>';
|
print '<tr><td>'.$langs->trans("AmountTTC").'</td><td>'.price($object->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
|
||||||
|
|
||||||
// Status
|
// Status
|
||||||
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
|
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4,$alreadypayed).'</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -78,12 +78,14 @@ llxHeader();
|
|||||||
|
|
||||||
$sql = "SELECT cs.rowid as id, cs.fk_type as type, ";
|
$sql = "SELECT cs.rowid as id, cs.fk_type as type, ";
|
||||||
$sql.= " cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode,";
|
$sql.= " cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode,";
|
||||||
$sql.= " c.libelle as type_lib";
|
$sql.= " c.libelle as type_lib,";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
$sql.= " SUM(pc.amount) as alreadypayed";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
|
||||||
|
$sql.= " ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||||
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid";
|
||||||
$sql.= " WHERE cs.fk_type = c.id";
|
$sql.= " WHERE cs.fk_type = c.id";
|
||||||
$sql.= " AND cs.entity = ".$conf->entity;
|
$sql.= " AND cs.entity = ".$conf->entity;
|
||||||
if (GETPOST("search_label")) $sql.=" AND cs.libelle LIKE '%".GETPOST("search_label")."%'";
|
if (GETPOST("search_label")) $sql.=" AND cs.libelle LIKE '%".$db->escape(GETPOST("search_label"))."%'";
|
||||||
if ($year > 0)
|
if ($year > 0)
|
||||||
{
|
{
|
||||||
$sql .= " AND (";
|
$sql .= " AND (";
|
||||||
@@ -100,6 +102,7 @@ if ($filtre) {
|
|||||||
if ($typeid) {
|
if ($typeid) {
|
||||||
$sql .= " AND cs.fk_type=".$typeid;
|
$sql .= " AND cs.fk_type=".$typeid;
|
||||||
}
|
}
|
||||||
|
$sql.= " GROUP BY cs.rowid, cs.fk_type, cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode, c.libelle";
|
||||||
$sql.= $db->order($sortfield,$sortorder);
|
$sql.= $db->order($sortfield,$sortorder);
|
||||||
$sql.= $db->plimit($limit+1,$offset);
|
$sql.= $db->plimit($limit+1,$offset);
|
||||||
|
|
||||||
@@ -207,7 +210,7 @@ if ($resql)
|
|||||||
// Due date
|
// Due date
|
||||||
print '<td width="110" align="center">'.dol_print_date($db->jdate($obj->date_ech), 'day').'</td>';
|
print '<td width="110" align="center">'.dol_print_date($db->jdate($obj->date_ech), 'day').'</td>';
|
||||||
|
|
||||||
print '<td align="right" class="nowrap">'.$chargesociale_static->LibStatut($obj->paye,5).'</a></td>';
|
print '<td align="right" class="nowrap">'.$chargesociale_static->LibStatut($obj->paye,5,$obj->alreadypayed).'</a></td>';
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
$i++;
|
$i++;
|
||||||
|
|||||||
@@ -1094,3 +1094,5 @@ ALTER TABLE llx_societe ADD INDEX idx_societe_barcode (barcode);
|
|||||||
ALTER TABLE llx_societe ADD UNIQUE INDEX uk_societe_barcode (barcode, fk_barcode_type, entity);
|
ALTER TABLE llx_societe ADD UNIQUE INDEX uk_societe_barcode (barcode, fk_barcode_type, entity);
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE llx_tva ADD COLUMN fk_typepayment integer NULL; -- table may already contains data
|
||||||
|
ALTER TABLE llx_tva ADD COLUMN num_payment varchar(50);
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ create table llx_tva
|
|||||||
datep date, -- date de paiement
|
datep date, -- date de paiement
|
||||||
datev date, -- date de valeur
|
datev date, -- date de valeur
|
||||||
amount real NOT NULL DEFAULT 0,
|
amount real NOT NULL DEFAULT 0,
|
||||||
|
fk_typepayment integer NULL,
|
||||||
|
num_payment varchar(50),
|
||||||
label varchar(255),
|
label varchar(255),
|
||||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||||
note text,
|
note text,
|
||||||
|
|||||||
Reference in New Issue
Block a user