*** empty log message ***
This commit is contained in:
parent
6e80adb393
commit
ff52dc1511
@ -49,7 +49,7 @@ print "</tr>";
|
||||
print "</table>";
|
||||
|
||||
if ($action == 'add') {
|
||||
$propal = new Propal($socidp);
|
||||
$propal = new Propal($db, $socidp);
|
||||
|
||||
$propal->remise = $remise;
|
||||
$propal->datep = $db->idate(mktime(12, 1 , 1, $pmonth, $pday, $pyear));
|
||||
@ -67,24 +67,27 @@ if ($action == 'add') {
|
||||
$propal->add_product($idprod3);
|
||||
$propal->add_product($idprod4);
|
||||
|
||||
$sqlok = $propal->create($db);
|
||||
$id = $propal->create();
|
||||
|
||||
/*
|
||||
*
|
||||
* Generation
|
||||
*
|
||||
*/
|
||||
if ($sqlok) {
|
||||
if ($id) {
|
||||
print "<hr><b>Génération du PDF</b><p>";
|
||||
|
||||
$command = "export DBI_DSN=\"".$GLOBALS["DBI"]."\" ";
|
||||
$command .= " ; ../../scripts/propal-tex.pl --propal=$propalid --pdf --gljroot=" . $GLOBALS["GLJ_ROOT"] ;
|
||||
//$DBI = "dbi:mysql:dbname=lolixdev:host=espy:user=rodo";
|
||||
|
||||
//$command .= " ; ../../scripts/fax-tex.pl --propal=$propalid --gljroot=" . $GLOBALS["GLJ_ROOT"] ;
|
||||
$gljroot = "/home/www/dolibarr/dolibarr/htdocs";
|
||||
|
||||
$command = "export DBI_DSN=\"dbi:mysql:dbname=".$conf->db->name.":host=localhost\" ";
|
||||
$command .= " ; ./propal-tex.pl --propal=".$id ." --pdf --output=".$conf->propal->outputdir;
|
||||
$command .= " --templates=".$conf->propal->templatesdir;
|
||||
|
||||
$output = system($command);
|
||||
print "<p>command : $command<br>";
|
||||
|
||||
print $output;
|
||||
} else {
|
||||
print $db->error();
|
||||
}
|
||||
@ -158,8 +161,8 @@ if ($action == 'create') {
|
||||
print "</select></td></tr>";
|
||||
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"add\">";
|
||||
$author = $GLOBALS["REMOTE_USER"];
|
||||
print "<tr><td>Auteur</td><td><input type=\"hidden\" name=\"author\" value=\"$author\">$author</td></tr>";
|
||||
|
||||
print '<tr><td>Auteur</td><td>'.$user->fullname.'</td></tr>';
|
||||
print "<tr><td>Num</td><td><input name=\"ref\" value=\"$numpr\"></td></tr>\n";
|
||||
/*
|
||||
*
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
*/
|
||||
|
||||
require("./pre.inc.php3");
|
||||
require("../lib/functions.inc.php3");
|
||||
|
||||
llxHeader();
|
||||
$db = new Db();
|
||||
$author = $GLOBALS["REMOTE_USER"];
|
||||
|
||||
@ -112,37 +112,19 @@ print "</DIV><P>";
|
||||
*
|
||||
*
|
||||
*/
|
||||
if ($mode == 'search')
|
||||
{
|
||||
if ($mode-search == 'soc')
|
||||
{
|
||||
$sql = "SELECT s.idp FROM societe as s, c_stcomm as st ";
|
||||
$sql .= " WHERE s.fk_stcomm = st.id AND s.datea IS NOT NULL";
|
||||
|
||||
if ($socname)
|
||||
{
|
||||
$sql .= " AND lower(s.nom) like '%".strtolower($socname)."%'";
|
||||
$sortfield = "lower(s.nom)";
|
||||
$sortorder = "ASC";
|
||||
}
|
||||
if ($mode == 'search') {
|
||||
if ($mode-search == 'soc') {
|
||||
$sql = "SELECT s.idp FROM societe as s ";
|
||||
$sql .= " WHERE lower(s.nom) like '%".strtolower($socname)."%'";
|
||||
}
|
||||
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ( $db->num_rows() == 1)
|
||||
{
|
||||
$obj = $db->fetch_object(0);
|
||||
$socid = $obj->idp;
|
||||
}
|
||||
$db->free();
|
||||
}
|
||||
if ( $db->query($sql) ) {
|
||||
if ( $db->num_rows() == 1) {
|
||||
$obj = $db->fetch_object(0);
|
||||
$socid = $obj->idp;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
$db->free();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
251
htdocs/comm/propal-tex.pl
Executable file
251
htdocs/comm/propal-tex.pl
Executable file
@ -0,0 +1,251 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
# Copyright (C) 2000-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
#
|
||||
# $Id$
|
||||
# $Source$
|
||||
#
|
||||
# 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.
|
||||
# or see http://www.gnu.org/
|
||||
|
||||
use strict;
|
||||
use POSIX;
|
||||
use DBI;
|
||||
use Sys::Syslog qw(:DEFAULT setlogsock);
|
||||
use Getopt::Long;
|
||||
Getopt::Long::Configure("bundling");
|
||||
|
||||
Sys::Syslog::setlogsock('unix');
|
||||
Sys::Syslog::openlog($0, 'pid', 'daemon');
|
||||
|
||||
|
||||
|
||||
my($debug, $verbose, $bgcolor, $idpropal, $do_fax, $do_pdf, $do_ps,
|
||||
$templatesdir, $outputdir) = (0,0);
|
||||
|
||||
exit unless GetOptions("propal=i" =>\$idpropal,
|
||||
"fax" =>\$do_fax,
|
||||
"templates=s" =>\$templatesdir,
|
||||
"output=s" =>\$outputdir,
|
||||
"ps" =>\$do_ps,
|
||||
"pdf" =>\$do_pdf,
|
||||
"v+" =>\$verbose);
|
||||
|
||||
Sys::Syslog::syslog('info', 'Start propale '.$idpropal);
|
||||
Sys::Syslog::syslog('info', '['.$idpropal.'] Start');
|
||||
my $DEBUG = 1;
|
||||
|
||||
my $mdir = "$outputdir";
|
||||
unless (-d $mdir) {
|
||||
mkdir($mdir,0777) || die "cannot mkdir " . $mdir . ": $!";
|
||||
}
|
||||
print "Output in : $outputdir\n" if $verbose > 1;
|
||||
#
|
||||
#
|
||||
# Fetch datas
|
||||
#
|
||||
Sys::Syslog::syslog('info', '['.$idpropal.'] Fetch data');
|
||||
my ($numpropale, $societe, $date, $ville, $destinataire, $price, $remise, $tva, $total);
|
||||
|
||||
my $dbh = DBI->connect("","","") || die $DBI::errstr ;
|
||||
|
||||
my $sql = "SELECT p.rowid, p.ref, s.nom, s.cp, s.ville, unix_timestamp(p.datep) as dp, c.name, c.firstname";
|
||||
$sql .= " ,p.price, p.remise, p.tva, p.total";
|
||||
$sql .= " FROM llx_propal as p, societe as s , socpeople as c";
|
||||
$sql .= " WHERE s.idp = p.fk_soc AND p.fk_soc_contact = c.idp AND p.rowid = $idpropal";
|
||||
|
||||
my $sth = $dbh->prepare("$sql") || die $dbh->errstr ;
|
||||
if ( $sth->execute ) {
|
||||
|
||||
if (! $sth->rows ) {
|
||||
$sth->finish;
|
||||
$dbh->disconnect if $dbh;
|
||||
print "\n" . $dbh->errstr;
|
||||
print "\n$sql\n";
|
||||
exit ;
|
||||
}
|
||||
|
||||
while (my $hsr = $sth->fetchrow_hashref ) {
|
||||
$numpropale = $hsr->{"ref"};
|
||||
$societe = $hsr->{"nom"};
|
||||
$destinataire = $hsr->{"firstname"} . " " . $hsr->{"name"};
|
||||
$date = $hsr->{"dp"};
|
||||
$ville = $hsr->{"cp"} . " " . $hsr->{"ville"};
|
||||
|
||||
$price = $hsr->{"price"};
|
||||
$remise = $hsr->{"remise"};
|
||||
$tva = $hsr->{"tva"};
|
||||
$total = $hsr->{"total"};
|
||||
}
|
||||
$sth->finish;
|
||||
} else {
|
||||
die $dbh->errstr;
|
||||
}
|
||||
|
||||
$outputdir .= "/".$numpropale;
|
||||
Sys::Syslog::syslog('info', '['.$idpropal.'] Outputdir : ' . $outputdir);
|
||||
unless (-d $outputdir) {
|
||||
print "Make dir : $outputdir\n" if $verbose > 1;
|
||||
mkdir($outputdir,0777) || die "cannot mkdir " . $outputdir . ": $!";
|
||||
}
|
||||
|
||||
print "Output in : $outputdir\n" if $verbose > 1;
|
||||
|
||||
my $adresse1 = "";
|
||||
my $adresse2 = "";
|
||||
|
||||
#
|
||||
#
|
||||
#
|
||||
my $headerfilename = "$templatesdir/header.tex";
|
||||
my $footerfilename = "$templatesdir/footer.tex";
|
||||
my $bodyfilename = "$templatesdir/body.tex";
|
||||
|
||||
unless (open (FC, ">$outputdir/$numpropale.tex") ) {
|
||||
print "can't write in $outputdir/$numpropale.tex: $!";
|
||||
Sys::Syslog::syslog('info', '['.$idpropal.'] ' . $outputdir/$numpropale.'.tex opened');
|
||||
Sys::Syslog::syslog('info', '['.$idpropal.'] ' . $!);
|
||||
}
|
||||
#
|
||||
# Header
|
||||
#
|
||||
open (FH, "<$headerfilename") || die "can't open $headerfilename: $!";
|
||||
while (<FH>) {
|
||||
s|\#SOCIETE\#|$societe|g;
|
||||
s|\#DESTINATAIRE\#|$destinataire|g;
|
||||
s|\#ADRESSE1\#|$adresse1|g;
|
||||
s|\#ADRESSE2\#|$adresse2|g;
|
||||
s|\#VILLE\#|$ville|g;
|
||||
|
||||
s|\#NUMPROPALE\#|$numpropale|g;
|
||||
s|\#DATE\#|$date|g;
|
||||
|
||||
print FC $_;
|
||||
}
|
||||
close (FH);
|
||||
#
|
||||
# Body
|
||||
#
|
||||
my $totalht = 0;
|
||||
my ($qty, $ref, $pu, $pricep, $label);
|
||||
#
|
||||
my $sql = "SELECT p.price, pr.ref, pr.label, pr.description";
|
||||
$sql .= " FROM llx_propaldet as p, llx_product as pr WHERE p.fk_propal = $idpropal AND p.fk_product = pr.rowid";
|
||||
|
||||
|
||||
$sth = $dbh->prepare("$sql") || die $dbh->errstr ;
|
||||
if ( $sth->execute ) {
|
||||
while (my $hsr = $sth->fetchrow_hashref ) {
|
||||
$label = $hsr->{"label"};
|
||||
$ref = $hsr->{"ref"};
|
||||
$societe = $hsr->{"nom"};
|
||||
$qty = 1 ;
|
||||
|
||||
$pu = sprintf("%.2f", $hsr->{"price"});
|
||||
$pricep = sprintf("%.2f", $hsr->{"price"});
|
||||
|
||||
open (FH, "<$bodyfilename") || die "can't open $bodyfilename: $!";
|
||||
while (<FH>) {
|
||||
s|\#LABEL\#|$hsr->{"description"}|g;
|
||||
s|\#QTY\#|$qty|g;
|
||||
s|\#REF\#|$ref|g;
|
||||
s|\#PU\#|$pu|g;
|
||||
s|\#PRICE\#|$pricep|g;
|
||||
print FC $_;
|
||||
}
|
||||
close (FH);
|
||||
}
|
||||
|
||||
$sth->finish;
|
||||
}
|
||||
#
|
||||
#
|
||||
#
|
||||
$totalht = $price - $remise ;
|
||||
my $francsht = $totalht * 6.55957;
|
||||
my $francsttc = $total * 6.55957;
|
||||
#
|
||||
# Footer
|
||||
#
|
||||
$price = sprintf("%.2f", $price);
|
||||
$remise = sprintf("%.2f", $remise);
|
||||
$totalht = sprintf("%.2f", $totalht);
|
||||
$tva = sprintf("%.2f", $tva);
|
||||
$total = sprintf("%.2f", $total);
|
||||
|
||||
$francsttc = sprintf("%.2f", $francsttc);
|
||||
$francsht = sprintf("%.2f", $francsht);
|
||||
|
||||
|
||||
$date = strftime("%d/%m/%Y", localtime($date));
|
||||
#
|
||||
open (FF, "<$footerfilename") || die "can't open $footerfilename: $!";
|
||||
while (<FF>) {
|
||||
s|\#SOCIETE\#|$societe|g;
|
||||
|
||||
s|\#DATE\#|$date|g;
|
||||
s|\#TOTALHT\#|$totalht|g;
|
||||
|
||||
s|\#FRANCSHT\#|$francsht|g;
|
||||
|
||||
s|\#REMISEHT\#|$remise|g;
|
||||
s|\#TVA\#|$tva|g;
|
||||
s|\#TOTALTTC\#|$total|g;
|
||||
|
||||
s|\#FRANCSTTC\#|$francsttc|g;
|
||||
|
||||
print FC $_;
|
||||
}
|
||||
close (FF);
|
||||
|
||||
|
||||
close (FC);
|
||||
|
||||
$dbh->disconnect if $dbh;
|
||||
#
|
||||
#
|
||||
#
|
||||
print "Generate dvi file<br>\n";
|
||||
system("cd $outputdir/ ; latex $numpropale.tex ");
|
||||
#
|
||||
#
|
||||
#
|
||||
if ($do_pdf) {
|
||||
print "<p>Generate pdf file<br>\n";
|
||||
system("cd $outputdir/ ; pdflatex $numpropale.tex > /dev/null");
|
||||
}
|
||||
#
|
||||
#
|
||||
#
|
||||
if ($do_ps) {
|
||||
print "Generate ps file\n";
|
||||
system("cd $outputdir/ ; dvips $numpropale.dvi -o $numpropale.ps > /dev/null");
|
||||
}
|
||||
#
|
||||
# $outputdir/$numpropale.tex
|
||||
#
|
||||
if ($do_fax) {
|
||||
print "Generate fax file\n";
|
||||
system("gs -q -sDEVICE=tiffg3 -dNOPAUSE -sOutputFile=$outputdir/$numpropale.%03d $outputdir/$numpropale.ps </dev/null");
|
||||
}
|
||||
Sys::Syslog::syslog('info', 'End propale '.$idpropal);
|
||||
Sys::Syslog::closelog();
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
#
|
||||
# export DBI_DSN="dbi:mysql:dbname=lolixfr:host=espy" ; ../scripts/propal-tex.pl
|
||||
#
|
||||
@ -22,6 +22,7 @@
|
||||
|
||||
class Propal {
|
||||
var $id;
|
||||
var $db;
|
||||
var $socidp;
|
||||
var $contactid;
|
||||
var $projetidp;
|
||||
@ -34,7 +35,8 @@ class Propal {
|
||||
|
||||
var $price;
|
||||
|
||||
Function Propal($soc_idp="") {
|
||||
Function Propal($DB, $soc_idp="") {
|
||||
$this->db = $DB ;
|
||||
$this->socidp = $soc_idp;
|
||||
$this->products = array();
|
||||
}
|
||||
@ -50,7 +52,7 @@ class Propal {
|
||||
*
|
||||
*
|
||||
*/
|
||||
Function create($db) {
|
||||
Function create() {
|
||||
/*
|
||||
* Total des produits a ajouter
|
||||
*/
|
||||
@ -61,9 +63,9 @@ class Propal {
|
||||
}
|
||||
$sql = substr($sql, 0, strlen($sql)-1) . ");";
|
||||
|
||||
if ( $db->query($sql) ) {
|
||||
$cprice = $db->result(0, 0);
|
||||
$db->free();
|
||||
if ( $this->db->query($sql) ) {
|
||||
$cprice = $this->db->result(0, 0);
|
||||
$this->db->free();
|
||||
}
|
||||
/*
|
||||
* Calcul TVA, Remise
|
||||
@ -78,25 +80,28 @@ class Propal {
|
||||
$sql .= " VALUES ($this->socidp, $this->contactid, $cprice, $this->remise, $tva, $total, $this->datep, now(), '$this->ref', $this->author, '$this->note')";
|
||||
$sqlok = 0;
|
||||
|
||||
if ( $db->query($sql) ) {
|
||||
if ( $this->db->query($sql) ) {
|
||||
|
||||
$this->id = $this->db->last_insert_id();
|
||||
|
||||
$sql = "SELECT rowid FROM llx_propal WHERE ref='$this->ref';";
|
||||
if ( $db->query($sql) ) {
|
||||
if ( $this->db->query($sql) ) {
|
||||
/*
|
||||
* Insertion du detail des produits dans la base
|
||||
*/
|
||||
if ( $db->num_rows() ) {
|
||||
$propalid = $db->result( 0, 0);
|
||||
$db->free();
|
||||
if ( $this->db->num_rows() ) {
|
||||
$propalid = $this->db->result( 0, 0);
|
||||
$this->db->free();
|
||||
|
||||
for ($i = 0 ; $i < sizeof($this->products) ; $i++) {
|
||||
$prod = new Product($db, $this->products[$i]);
|
||||
$prod = new Product($this->db, $this->products[$i]);
|
||||
$prod->fetch();
|
||||
|
||||
$sql = "INSERT INTO llx_propaldet (fk_propal, fk_product, price) VALUES ";
|
||||
$sql .= " ($propalid,". $this->products[$i].", $prod->price) ; ";
|
||||
|
||||
if (! $db->query($sql) ) {
|
||||
print $sql . '<br>' . $db->error() .'<br>';
|
||||
if (! $this->db->query($sql) ) {
|
||||
print $sql . '<br>' . $this->db->error() .'<br>';
|
||||
}
|
||||
}
|
||||
/*
|
||||
@ -104,23 +109,22 @@ class Propal {
|
||||
*/
|
||||
if ($this->projetidp) {
|
||||
$sql = "UPDATE llx_propal SET fk_projet=$this->projetidp WHERE ref='$this->ref';";
|
||||
$db->query($sql);
|
||||
$this->db->query($sql);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
print $db->error() . '<b><br>'.$sql;
|
||||
print $this->db->error() . '<b><br>'.$sql;
|
||||
}
|
||||
} else {
|
||||
print $db->error() . '<b><br>'.$sql;
|
||||
print $this->db->error() . '<b><br>'.$sql;
|
||||
}
|
||||
return 1;
|
||||
return $this->id;
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
Function fetch($db, $rowid) {
|
||||
|
||||
$sql = "SELECT ref,price,".$db->pdate(datep)."as dp FROM llx_propal WHERE rowid=$rowid;";
|
||||
@ -140,6 +144,45 @@ class Propal {
|
||||
print $db->error();
|
||||
}
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
Function valid($userid) {
|
||||
$sql = "UPDATE llx_propal SET fk_statut = 1, date_valid=now(), fk_user_valid=$userid";
|
||||
$sql .= " WHERE rowid = $this->id;";
|
||||
|
||||
if ($this->db->query($sql) ) {
|
||||
return 1;
|
||||
} else {
|
||||
print $this->db->error() . ' in ' . $sql;
|
||||
}
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
Function cloture($userid, $statut, $note) {
|
||||
$sql = "UPDATE llx_propal SET fk_statut = $statut, note = '$note', date_cloture=now(), fk_user_cloture=$userid";
|
||||
|
||||
$sql .= " WHERE rowid = $this->id;";
|
||||
|
||||
if ($this->db->query($sql) ) {
|
||||
return 1;
|
||||
} else {
|
||||
print $this->db->error() . ' in ' . $sql;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@ -26,17 +26,17 @@ require("../lib/CMailFile.class.php3");
|
||||
* Modules optionnels
|
||||
*/
|
||||
require("projet/project.class.php3");
|
||||
require("./propal.class.php3");
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
$author = $GLOBALS["REMOTE_USER"];
|
||||
|
||||
llxHeader();
|
||||
|
||||
print "<table width=\"100%\">";
|
||||
print "<tr><td>Propositions commerciales</td>";
|
||||
if ($socidp) {
|
||||
print "<td align=\"right\"><a href=\"addpropal.php3?socidp=$socidp&action=create\">Nouvelle Propal</a></td>";
|
||||
print "<td bgcolor=\"#e0e0e0\" align=\"center\">[<a href=\"addpropal.php3?socidp=$socidp&action=create\">Nouvelle Propal</a>]</td>";
|
||||
}
|
||||
print "<td align=\"right\"><a href=\"propal.php3\">Liste</a></td>";
|
||||
print "<td align=\"right\"><a href=\"/compta/prev.php3\">CA Prévisionnel</a></td>";
|
||||
@ -65,8 +65,13 @@ $pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
if ($action == 'setstatut') {
|
||||
$sql = "UPDATE llx_propal SET fk_statut = $statut, note = '$note' WHERE rowid = $propalid";
|
||||
$result = $db->query($sql);
|
||||
/*
|
||||
* Cloture de la propale
|
||||
*/
|
||||
$propal = new Propal($db);
|
||||
$propal->id = $propalid;
|
||||
$propal->cloture($user->id, $statut, $note);
|
||||
|
||||
} elseif ( $action == 'delete' ) {
|
||||
$sql = "DELETE FROM llx_propal WHERE rowid = $propalid;";
|
||||
if ( $db->query($sql) ) {
|
||||
@ -88,17 +93,15 @@ if ($action == 'setstatut') {
|
||||
|
||||
if ($propalid) {
|
||||
if ($valid == 1) {
|
||||
$sql = "SELECT p.fk_soc, p.fk_projet,p.price, p.ref,".$db->pdate("p.datep")." as dp, p.author";
|
||||
$sql = "SELECT p.fk_soc, p.fk_projet,p.price, p.ref,".$db->pdate("p.datep")." as dp";
|
||||
$sql .= " FROM llx_propal as p WHERE p.rowid = $propalid";
|
||||
|
||||
if ( $db->query($sql) ) {
|
||||
$obj = $db->fetch_object( 0 );
|
||||
|
||||
$sql = "UPDATE llx_propal SET fk_statut = 1 WHERE rowid = $propalid;";
|
||||
if (! $db->query($sql) ) {
|
||||
print $db->error();
|
||||
}
|
||||
|
||||
$propal = new Propal($db);
|
||||
$propal->id = $propalid;
|
||||
$propal->valid($user->id);
|
||||
} else {
|
||||
print $db->error();
|
||||
}
|
||||
@ -106,16 +109,10 @@ if ($propalid) {
|
||||
/*
|
||||
*
|
||||
*/
|
||||
$sql = "SELECT s.nom, s.idp, p.price, p.fk_projet,p.remise, p.tva, p.total, p.ref,".$db->pdate("p.datep")." as dp, c.id as statut, c.label as lst, p.author, p.note, x.firstname, x.name, x.fax, x.phone, x.email";
|
||||
$sql = "SELECT s.nom, s.idp, p.price, p.fk_projet,p.remise, p.tva, p.total, p.ref,".$db->pdate("p.datep")." as dp, c.id as statut, c.label as lst, p.note, x.firstname, x.name, x.fax, x.phone, x.email, p.fk_user_author, p.fk_user_valid, p.fk_user_cloture, p.datec, p.date_valid, p.date_cloture";
|
||||
$sql .= " FROM societe as s, llx_propal as p, c_propalst as c, socpeople as x";
|
||||
$sql .= " WHERE p.fk_soc = s.idp AND p.fk_statut = c.id AND x.idp = p.fk_soc_contact AND p.rowid = $propalid";
|
||||
|
||||
|
||||
/* $sql = "SELECT s.nom, s.idp, p.price, p.remise, p.tva, p.total, p.ref,".$db->pdate("p.datep")." as dp, c.id as statut, c.label as lst, p.author, p.note, x.firstname, x.name, x.fax, x.phone, x.email";
|
||||
* $sql .= " FROM societe as s, llx_propal as p, c_propalst as c";
|
||||
* $sql .= " WHERE p.fk_soc = s.idp AND p.fk_statut = c.id AND p.rowid = $propalid";
|
||||
*/
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ( $result ) {
|
||||
@ -154,7 +151,10 @@ if ($propalid) {
|
||||
/*
|
||||
*
|
||||
*/
|
||||
print "<tr><td>Auteur</td><td colspan=\"2\">$obj->author</td>";
|
||||
print '<tr><td>Auteur</td><td colspan="2">';
|
||||
$author = new User($db, $obj->fk_user_author);
|
||||
$author->fetch('');
|
||||
print $author->fullname.'</td>';
|
||||
|
||||
$totalht = $obj->price - $obj->remise ;
|
||||
|
||||
@ -195,7 +195,7 @@ if ($propalid) {
|
||||
print "<option value=\"3\">Non Signée";
|
||||
print '</select>';
|
||||
print '<br><textarea cols="60" rows="6" wrap="soft" name="note">';
|
||||
print $obj->note . "\n--------------------------\n";
|
||||
print $obj->note . "\n----------\n";
|
||||
print '</textarea><br><input type="submit" value="Valider">';
|
||||
print "</form>";
|
||||
}
|
||||
@ -366,16 +366,16 @@ if ($propalid) {
|
||||
print "<b>Documents générés</b><br>";
|
||||
print "<table width=\"100%\" cellspacing=0 border=1 cellpadding=3>";
|
||||
|
||||
$file = $GLOBALS["GLJ_ROOT"] . "/www-sys/doc/propal/$obj->ref/$obj->ref.pdf";
|
||||
$file = $conf->propal->outputdir. "/$obj->ref/$obj->ref.pdf";
|
||||
if (file_exists($file)) {
|
||||
print "<tr><td>Propale PDF</a></td><td><a href=\"../../doc/propal/$obj->ref/$obj->ref.pdf\">$obj->ref.pdf</a></td></tr>";
|
||||
}
|
||||
$file = $GLOBALS["GLJ_ROOT"] . "/www-sys/doc/propal/$obj->ref/$obj->ref.ps";
|
||||
$file = $conf->propal->outputdir . "/$obj->ref/$obj->ref.ps";
|
||||
if (file_exists($file)) {
|
||||
print "<tr><td>Propale Postscript</a></td><td><a href=\"../../doc/propal/$obj->ref/$obj->ref.ps\">$obj->ref.ps</a></td>";
|
||||
print "</tr>";
|
||||
}
|
||||
print "<tr><td colspan=\"2\">(<a href=\"../../doc/propal/$obj->ref/\">liste...</a>)</td></tr>";
|
||||
print '<tr><td colspan="2">(<a href="'.$conf->propal->outputurl.'/'.$obj->ref.'">liste...</a>)</td></tr>';
|
||||
|
||||
$file = $GLOBALS["GLJ_ROOT"] . "/www-sys/doc/propale/$obj->ref/FAX-$obj->ref.ps";
|
||||
if (file_exists($file)) {
|
||||
@ -447,6 +447,24 @@ if ($propalid) {
|
||||
print "<p><b>$sql";
|
||||
}
|
||||
|
||||
$validor = new User($db, $obj->fk_user_valid);
|
||||
$validor->fetch('');
|
||||
$cloturor = new User($db, $obj->fk_user_cloture);
|
||||
$cloturor->fetch('');
|
||||
|
||||
print '<table cellspacing=0 border=1 cellpadding=3>';
|
||||
print '<tr><td> </td><td>Nom</td><td>Date</td></tr>';
|
||||
print '<tr><td>Création</td><td>'.$author->fullname.'</td>';
|
||||
print '<td>'.$obj->datec.'</td></tr>';
|
||||
|
||||
print '<tr><td>Validation</td><td>'.$validor->fullname.' </td>';
|
||||
print '<td>'.$obj->date_valid.' </td></tr>';
|
||||
|
||||
print '<tr><td>Cloture</td><td>'.$cloturor->fullname.' </td>';
|
||||
print '<td>'.$obj->date_cloture.' </td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
} else {
|
||||
print $db->error();
|
||||
print "<p><b>$sql";
|
||||
|
||||
@ -42,7 +42,7 @@ class Conf {
|
||||
|
||||
class PropalConf {
|
||||
Function PropalConf() {
|
||||
$this->templatesdir = "/home/www/dolibarr/dolibarr/templates";
|
||||
$this->templatesdir = "/home/www/dolibarr/dolibarr/templates/propal/default";
|
||||
$this->outputdir = "/home/www/dolibarr/dolibarr/htdocs/document/propal";
|
||||
/*
|
||||
* Without ended slash
|
||||
|
||||
@ -61,20 +61,21 @@ if ($db->ok) {
|
||||
print "<td>Description</td><td>Valeur</TD>";
|
||||
print "</TR>\n";
|
||||
|
||||
$sql = "SELECT count(*) FROM llx_propal WHERE fk_statut = 0";
|
||||
if (valeur($sql)) {
|
||||
$var=!$var;
|
||||
$sql = "SELECT count(*) FROM llx_propal WHERE fk_statut = 0";
|
||||
print "<tr $bc[$var]><td><a href=\"comm/propal.php3?viewstatut=0\">Propales brouillons</a></td><td align=\"right\">".valeur($sql)."</td></tr>";
|
||||
}
|
||||
|
||||
$sql = "SELECT count(*) FROM llx_propal WHERE fk_statut = 1";
|
||||
if (valeur($sql)) {
|
||||
$var=!$var;
|
||||
$sql = "SELECT count(*) FROM llx_propal WHERE fk_statut = 1";
|
||||
print "<tr $bc[$var]><td><a href=\"comm/propal.php3?viewstatut=1\">Propales ouvertes</a></td><td align=\"right\">".valeur($sql)."</td></tr>";
|
||||
}
|
||||
|
||||
$sql = "SELECT count(*) FROM llx_facture WHERE paye=0";
|
||||
if (valeur($sql)) {
|
||||
$var=!$var;
|
||||
$sql = "SELECT count(*) FROM llx_facture WHERE paye=0";
|
||||
print "<tr $bc[$var]><td><a href=\"compta/index.php3\">Factures en attente de paiement</a></td><td align=\"right\">".valeur($sql)."</td></tr>";
|
||||
}
|
||||
|
||||
|
||||
@ -24,13 +24,20 @@ require("./pre.inc.php3");
|
||||
llxHeader();
|
||||
print '<table border="1" cellpadding="3" cellspacing="0">';
|
||||
|
||||
print '<tr><td colspan="2">Database</td></tr>';
|
||||
|
||||
print '<tr><td bgcolor="#e0e0e0" colspan="2">Database</td></tr>';
|
||||
print '<tr><td>host</td><td>' . $conf->db->host . '</td></tr>';
|
||||
print '<tr><td>user</td><td>' . $conf->db->user . '</td></tr>';
|
||||
print '<tr><td>pass</td><td>' . $conf->db->pass . '</td></tr>';
|
||||
print '<tr><td>user</td><td>' . $conf->db->user . ' </td></tr>';
|
||||
print '<tr><td>pass</td><td>' . $conf->db->pass . ' </td></tr>';
|
||||
print '<tr><td>Database name</td><td>' . $conf->db->name . '</td></tr>';
|
||||
|
||||
|
||||
print '<tr><td bgcolor="#e0e0e0" colspan="2">Propale</td></tr>';
|
||||
print '<tr><td>templates</td><td>' . $conf->propal->templatesdir . '</td></tr>';
|
||||
print '<tr><td>output dir</td><td>' . $conf->propal->outputdir . '</td></tr>';
|
||||
print '<tr><td>output url</td><td>' . $conf->propal->outputurl . '</td></tr>';
|
||||
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
|
||||
@ -3,6 +3,21 @@
|
||||
--
|
||||
-- $Id$
|
||||
-- $Source$
|
||||
--
|
||||
-- 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.
|
||||
--
|
||||
-- ===================================================================
|
||||
|
||||
create table llx_propal
|
||||
@ -12,10 +27,20 @@ create table llx_propal
|
||||
fk_soc_contact integer,
|
||||
fk_projet integer default 0, -- projet auquel est rattache la propale
|
||||
ref varchar(30) NOT NULL, -- propal number
|
||||
datec datetime, -- date de creation de l'enregistrement
|
||||
|
||||
datec datetime, -- date de creation
|
||||
date_valid datetime, -- date de validation
|
||||
date_cloture datetime, -- date de cloture
|
||||
|
||||
datep date, -- date de la propal
|
||||
author varchar(30),
|
||||
|
||||
fk_user_author integer, -- createur de la propale
|
||||
|
||||
fk_user_valid integer, -- valideur de la propale
|
||||
|
||||
fk_user_cloture integer, -- cloture de la propale signee ou non signee
|
||||
|
||||
|
||||
fk_statut smallint default 0,
|
||||
price real default 0,
|
||||
remise real default 0,
|
||||
|
||||
9
templates/propal/default/body.tex
Normal file
9
templates/propal/default/body.tex
Normal file
@ -0,0 +1,9 @@
|
||||
\multicolumn{1}{|c|}{#REF#} &
|
||||
|
||||
#LABEL#
|
||||
&
|
||||
\multicolumn{1}{|c|}{#QTY#} &
|
||||
\multicolumn{1}{|r|}{#PU#} &
|
||||
\multicolumn{1}{|r|}{#PRICE#} \\
|
||||
\hline
|
||||
|
||||
104
templates/propal/default/header.tex
Normal file
104
templates/propal/default/header.tex
Normal file
@ -0,0 +1,104 @@
|
||||
%
|
||||
% header.tex
|
||||
%
|
||||
% $Id$
|
||||
% $Source$
|
||||
\documentclass[a4paper]{article}
|
||||
\usepackage{fancyhdr, hhline}
|
||||
\usepackage[francais]{layout}
|
||||
%
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage[french]{babel}
|
||||
%
|
||||
%
|
||||
\newcommand{\aquatre}{
|
||||
|
||||
\setlength{\topmargin}{0pt}
|
||||
\setlength{\textheight}{21cm}
|
||||
|
||||
\setlength{\headheight}{30pt}
|
||||
|
||||
\setlength{\headsep}{30pt}
|
||||
|
||||
\setlength{\parindent}{1cm}
|
||||
\setlength{\parskip}{0.2cm}
|
||||
|
||||
\setlength{\oddsidemargin}{0pt}
|
||||
\setlength{\evensidemargin}{0pt}
|
||||
|
||||
\setlength{\textwidth}{480pt}
|
||||
|
||||
|
||||
\setlength{\marginparwidth}{0pt}
|
||||
\setlength{\marginparsep}{0pt}
|
||||
}
|
||||
% Definitions des commandes
|
||||
%
|
||||
\cfoot{}
|
||||
%
|
||||
% Debut du document
|
||||
%
|
||||
\aquatre
|
||||
|
||||
%\lhead{\begin{tabular}{|p{9cm}p{6cm}}\textsf{{\LARGE Lolix SA}}
|
||||
%&\\\textsf{8, rue de Valois} & \textsf{T\'el : +33 1 40 15 03 18}
|
||||
%\\\textsf{75001 Paris} & \textsf{Fax : +33 1 40 15 06 18}
|
||||
%\\\textsf{SIREN : 432073666} &\\\end{tabular}}
|
||||
|
||||
\lhead{\textsf{{\LARGE Societe SA}}\\\textsf{Travaillons Libre}\\http://www.www.com/}
|
||||
|
||||
\renewcommand{\headrulewidth}{1.0pt}
|
||||
\pagestyle{fancy}
|
||||
%
|
||||
% Redefinition des font en type 1 (voir page 218)
|
||||
%
|
||||
\renewcommand{\sfdefault}{phv}
|
||||
\renewcommand{\rmdefault}{ptm}
|
||||
\renewcommand{\ttdefault}{pcr}
|
||||
|
||||
\begin{document}
|
||||
%\layout
|
||||
\begin{flushright}
|
||||
\begin{tabular}{p{220pt}|p{220pt}|}
|
||||
\hhline{~-}
|
||||
Societe SA & \\
|
||||
SA au capital de 40 000 euros & \textbf{\Large #SOCIETE#} \\
|
||||
R.C.S. : Paris B 999 999 999 & {\large #DESTINATAIRE#} \\
|
||||
& {\large #ADRESSE1#} \\
|
||||
8 rue de Valois, 75001 Paris & {\large #ADRESSE2#} \\
|
||||
Tél (33) 1 01 01 01 01 - Fax (33) 1 01 01 01 18 & {\large #VILLE#} \\
|
||||
email : email@eamil.com & \\
|
||||
\hhline{~-}
|
||||
\end{tabular}
|
||||
\end{flushright}
|
||||
|
||||
\begin{center}
|
||||
\begin{tabular}{c}
|
||||
\\
|
||||
\\
|
||||
\textbf{\LARGE PROPOSITION COMMERCIALE}
|
||||
\\
|
||||
\\
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
|
||||
\begin{flushleft}
|
||||
\begin{tabular}{p{9cm}}
|
||||
\\
|
||||
Proposition numéro : \textbf{#NUMPROPALE#} \\
|
||||
\end{tabular}
|
||||
\end{flushleft}
|
||||
|
||||
\large{}
|
||||
|
||||
\begin{center}
|
||||
|
||||
\begin{tabular}{|p{2cm}|p{7cm}|p{2cm}|p{2cm}|p{2cm}|}
|
||||
\hline
|
||||
\multicolumn{1}{|c|}{\textbf{Réf}} &
|
||||
\multicolumn{1}{|c|}{\textbf{Désignation}} &
|
||||
\multicolumn{1}{|c|}{\textbf{Qté}} &
|
||||
\multicolumn{1}{|r|}{\textbf{P.U.}} &
|
||||
\multicolumn{1}{|r|}{\textbf{Total}} \\
|
||||
\hline
|
||||
|
||||
Loading…
Reference in New Issue
Block a user