New: L'apercu des modeles sur les fiches interventions fonctionne
This commit is contained in:
parent
536d09fe38
commit
b7417233bf
@ -45,7 +45,35 @@ if (!$user->admin)
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($_GET["action"] == 'specimen')
|
||||
{
|
||||
$modele=$_GET["module"];
|
||||
|
||||
$inter = new Fichinter($db);
|
||||
$inter->initAsSpecimen();
|
||||
|
||||
// Charge le modele
|
||||
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/fichinter/";
|
||||
$file = "pdf_".$modele.".modules.php";
|
||||
if (file_exists($dir.$file))
|
||||
{
|
||||
$classname = "pdf_".$modele;
|
||||
require_once($dir.$file);
|
||||
|
||||
$obj = new $classname($db);
|
||||
|
||||
if ($obj->write_pdf_file($inter,$langs) > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=ficheinter&file=SPECIMEN.pdf");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorModuleNotFound").'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($_GET["action"] == 'set')
|
||||
{
|
||||
$type='ficheinter';
|
||||
|
||||
@ -813,11 +813,85 @@ class Fichinter extends CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Initialise la fiche intervention avec valeurs fictives aléatoire
|
||||
* Sert à générer une fiche intervention pour l'aperu des modèles ou demo
|
||||
*/
|
||||
function initAsSpecimen()
|
||||
{
|
||||
global $user,$langs;
|
||||
|
||||
// Charge tableau des id de société socids
|
||||
$socids = array();
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe WHERE client=1 LIMIT 10";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num_socs = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num_socs)
|
||||
{
|
||||
$i++;
|
||||
|
||||
$row = $this->db->fetch_row($resql);
|
||||
$socids[$i] = $row[0];
|
||||
}
|
||||
}
|
||||
|
||||
// Charge tableau des produits prodids
|
||||
$prodids = array();
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product WHERE envente=1";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num_prods = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num_prods)
|
||||
{
|
||||
$i++;
|
||||
$row = $this->db->fetch_row($resql);
|
||||
$prodids[$i] = $row[0];
|
||||
}
|
||||
}
|
||||
|
||||
// Initialise paramètres
|
||||
$this->id=0;
|
||||
$this->ref = 'SPECIMEN';
|
||||
$this->specimen=1;
|
||||
$socid = rand(1, $num_socs);
|
||||
$this->socid = $socids[$socid];
|
||||
$this->date = time();
|
||||
$this->date_lim_reglement=$this->date+3600*24*30;
|
||||
$this->cond_reglement_code = 'RECEP';
|
||||
$this->mode_reglement_code = 'CHQ';
|
||||
$this->note_public='SPECIMEN';
|
||||
$nbp = 5;
|
||||
$xnbp = 0;
|
||||
while ($xnbp < $nbp)
|
||||
{
|
||||
$ligne=new FichinterLigne($this->db);
|
||||
$ligne->desc=$langs->trans("Description")." ".$xnbp;
|
||||
$ligne->qty=1;
|
||||
$ligne->subprice=100;
|
||||
$ligne->price=100;
|
||||
$ligne->tva_tx=19.6;
|
||||
$prodid = rand(1, $num_prods);
|
||||
$ligne->produit_id=$prodids[$prodid];
|
||||
$this->lignes[$xnbp]=$ligne;
|
||||
$xnbp++;
|
||||
}
|
||||
|
||||
$this->amount_ht = $xnbp*100;
|
||||
$this->total_ht = $xnbp*100;
|
||||
$this->total_tva = $xnbp*19.6;
|
||||
$this->total_ttc = $xnbp*119.6;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\class FichinterLigne
|
||||
\class FichinterLigne
|
||||
\brief Classe permettant la gestion des lignes d'intervention
|
||||
*/
|
||||
|
||||
|
||||
@ -61,6 +61,13 @@ class pdf_soleil extends ModelePDFFicheinter
|
||||
$this->marge_droite=10;
|
||||
$this->marge_haute=10;
|
||||
$this->marge_basse=10;
|
||||
|
||||
$this->option_logo = 1; // Affiche logo
|
||||
$this->option_tva = 0; // Gere option tva FACTURE_TVAOPTION
|
||||
$this->option_modereg = 0; // Affiche mode règlement
|
||||
$this->option_condreg = 0; // Affiche conditions règlement
|
||||
$this->option_codeproduitservice = 0; // Affiche code produit-service
|
||||
$this->option_multilang = 0; // Dispo en plusieurs langues
|
||||
|
||||
// Recupere code pays de l'emmetteur
|
||||
$this->emetteur=$mysoc;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user