NEW : VAT payment v6 look and feel

This commit is contained in:
Alexandre SPANGARO 2017-06-05 15:41:33 +02:00
parent 344263f53c
commit e547aa8aee
5 changed files with 93 additions and 53 deletions

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2016 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>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@zendsi.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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -305,16 +305,17 @@ if ($id)
dol_fiche_head($head, 'card', $langs->trans("VATPayment"), 0, 'payment'); dol_fiche_head($head, 'card', $langs->trans("VATPayment"), 0, 'payment');
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/tva/reglement.php">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', '');
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print "<tr>";
print '<td class="titlefield">'.$langs->trans("Ref").'</td><td colspan="3">';
print $object->ref;
print '</td></tr>';
// Label // Label
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>'; print '<tr><td class="titlefield">'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>';
print "<tr>"; print "<tr>";
print '<td>'.$langs->trans("DatePayment").'</td><td>'; print '<td>'.$langs->trans("DatePayment").'</td><td>';
@ -335,23 +336,25 @@ if ($id)
{ {
if ($object->fk_account > 0) if ($object->fk_account > 0)
{ {
$bankline=new AccountLine($db); $bankline=new AccountLine($db);
$bankline->fetch($object->fk_bank); $bankline->fetch($object->fk_bank);
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans('BankTransactionLine').'</td>'; print '<td>'.$langs->trans('BankTransactionLine').'</td>';
print '<td>'; print '<td>';
print $bankline->getNomUrl(1,0,'showall'); print $bankline->getNomUrl(1,0,'showall');
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
} }
// Other attributes // Other attributes
$reshook=$hookmanager->executeHooks('formObjectOptions','',$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions','',$object,$action); // Note that $action and $object may have been modified by hook
print '</table>'; print '</table>';
print '</div>';
dol_fiche_end(); dol_fiche_end();
/* /*

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2011-2017 Alexandre Spangaro <aspangaro@zendsi.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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -34,6 +34,7 @@ class Tva extends CommonObject
{ {
//public $element='tva'; //!< Id that identify managed objects //public $element='tva'; //!< Id that identify managed objects
//public $table_element='tva'; //!< Name of table without prefix where object is stored //public $table_element='tva'; //!< Name of table without prefix where object is stored
public $picto='payment';
var $tms; var $tms;
var $datep; var $datep;
@ -73,6 +74,7 @@ class Tva extends CommonObject
global $conf, $langs; global $conf, $langs;
$error=0; $error=0;
$now=dol_now();
// Clean parameters // Clean parameters
$this->amount=trim($this->amount); $this->amount=trim($this->amount);
@ -89,7 +91,7 @@ class Tva extends CommonObject
// Insert request // Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."tva("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."tva(";
$sql.= "tms,"; $sql.= "datec,";
$sql.= "datep,"; $sql.= "datep,";
$sql.= "datev,"; $sql.= "datev,";
$sql.= "amount,"; $sql.= "amount,";
@ -101,7 +103,7 @@ class Tva extends CommonObject
$sql.= ") VALUES ("; $sql.= ") VALUES (";
$sql.= " '".$this->db->idate($this->tms)."',"; $sql.= " '".$this->db->idate($now)."',";
$sql.= " '".$this->db->idate($this->datep)."',"; $sql.= " '".$this->db->idate($this->datep)."',";
$sql.= " '".$this->db->idate($this->datev)."',"; $sql.= " '".$this->db->idate($this->datev)."',";
$sql.= " '".$this->amount."',"; $sql.= " '".$this->amount."',";
@ -677,46 +679,70 @@ class Tva extends CommonObject
* @param int $id Id of vat payment * @param int $id Id of vat payment
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function info($id) function info($id)
{ {
$sql = "SELECT t.rowid, t.tms as datec, t.fk_user_creat"; $sql = "SELECT t.rowid, t.tms, t.datec, t.fk_user_creat";
$sql.= " FROM ".MAIN_DB_PREFIX."tva as t"; $sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
$sql.= " WHERE t.rowid = ".$id; $sql.= " WHERE t.rowid = ".$id;
dol_syslog(get_class($this)."::info", LOG_DEBUG); dol_syslog(get_class($this)."::info", LOG_DEBUG);
$result=$this->db->query($sql); $result=$this->db->query($sql);
if ($result) if ($result)
{ {
if ($this->db->num_rows($result)) if ($this->db->num_rows($result))
{ {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$this->id = $obj->rowid; $this->id = $obj->rowid;
if ($obj->fk_user_creat) { if ($obj->fk_user_creat) {
$cuser = new User($this->db); $cuser = new User($this->db);
$cuser->fetch($obj->fk_user_creat); $cuser->fetch($obj->fk_user_creat);
$this->user_creation = $cuser; $this->user_creation = $cuser;
} }
if ($obj->fk_user_modif) { if ($obj->fk_user_modif) {
$muser = new User($this->db); $muser = new User($this->db);
$muser->fetch($obj->fk_user_modif); $muser->fetch($obj->fk_user_modif);
$this->user_modification = $muser; $this->user_modification = $muser;
} }
$this->date_creation = $this->db->jdate($obj->datec); $this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->datec); $this->date_modification = $this->db->jdate($obj->tms);
$this->import_key = $obj->import_key; $this->import_key = $obj->import_key;
} }
$this->db->free($result); $this->db->free($result);
} }
else else
{ {
dol_print_error($this->db); dol_print_error($this->db);
} }
} }
/**
* Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee)
*
* @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 Libelle
*/
function getLibStatut($mode=0)
{
return $this->LibStatut($this->statut,$mode);
}
/**
* Renvoi le libelle d'un statut donne
*
* @param int $status Statut
* @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 Libelle du statut
*/
function LibStatut($status,$mode=0)
{
global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage
return '';
}
} }

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2016 Alexandre Spangaro <aspangaro@zendsi.com> /* Copyright (C) 2016-2017 Alexandre Spangaro <aspangaro@zendsi.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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -53,12 +53,21 @@ $head = vat_prepare_head($object);
dol_fiche_head($head, 'info', $langs->trans("VATPayment"), 0, 'payment'); dol_fiche_head($head, 'info', $langs->trans("VATPayment"), 0, 'payment');
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/tva/reglement.php">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', '');
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table width="100%"><tr><td>'; print '<table width="100%"><tr><td>';
dol_print_object_info($object); dol_print_object_info($object);
print '</td></tr></table>'; print '</td></tr></table>';
print '</div>'; print '</div>';
dol_fiche_end();
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -379,3 +379,4 @@ create table llx_loan_schedule
fk_user_modif integer fk_user_modif integer
)ENGINE=innodb; )ENGINE=innodb;
ALTER TABLE llx_tva ADD COLUMN datec date AFTER tms;

View File

@ -21,6 +21,7 @@ create table llx_tva
( (
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp, tms timestamp,
datec datetime, -- Create date
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,