SD-1 mise en place des factures
This commit is contained in:
parent
1e2182d34e
commit
273f6c1976
@ -9,7 +9,7 @@ class Achatclient_InextensoController extends Zend_Controller_Action
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
protected $libdroits = 'searchent';
|
||||
protected $libdroits = 'portemonnaie';
|
||||
|
||||
protected $maxcredit=2000;
|
||||
|
||||
@ -26,13 +26,29 @@ class Achatclient_InextensoController extends Zend_Controller_Action
|
||||
public function indexAction()
|
||||
{
|
||||
$user = new Scores_Utilisateur();
|
||||
$idUser=$user->identity->id;
|
||||
//var_dump($user);die;
|
||||
$ok=$user->checkperm($this->libdroits);
|
||||
if(!$ok){
|
||||
$this->msg = 'Fonction indisponible';
|
||||
}
|
||||
$request = $this->getRequest();
|
||||
$id=$request->getParam('id');
|
||||
|
||||
$id=intval($request->getParam('id'));
|
||||
if($id==0){
|
||||
$this->view->message=__LINE__;
|
||||
return false;
|
||||
}
|
||||
$ws = new Scores_Ws_Client('credit', '0.1');
|
||||
$params = new stdClass();
|
||||
$params->id = $id;
|
||||
$infocredit = $ws->getfactinfosCredit($params);
|
||||
foreach($infocredit->result as $item){
|
||||
$infos[$item->key]=array();
|
||||
foreach($item->value->item as $obj){
|
||||
$infos[$item->key][$obj->key]=$obj->value;
|
||||
}
|
||||
}
|
||||
//var_dump($infos);die;
|
||||
// create new PDF document
|
||||
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
|
||||
|
||||
@ -94,22 +110,28 @@ class Achatclient_InextensoController extends Zend_Controller_Action
|
||||
// Acheteur
|
||||
$pdf->SetXY(120, 60);
|
||||
$paidResult=new stdClass();
|
||||
$paidResult->UserId= 'UserId';
|
||||
$paidResult->UserName = 'UserName';
|
||||
$paidResult->UserFirstname = 'UserFirstname';
|
||||
$paidResult->ClientName = 'ClientName';
|
||||
$paidResult->ClientFacDest = 'ClientFacDest';
|
||||
$paidResult->ClientFacAdr1 = 'ClientFacAdr1';
|
||||
$paidResult->ClientFacAdr2 = 'ClientFacAdr2';
|
||||
$paidResult->ClientFacAdr3 = 'ClientFacAdr3';
|
||||
$paidResult->nbCredit = '2000';
|
||||
$paidResult->amount = '24,00';
|
||||
$paidResult->amount_ht = '20,00';
|
||||
$paidResult->amount_tva = '4,00';
|
||||
$paidResult->taux_tva = '20 %';
|
||||
$paidResult->idCmd = 'idCmd';
|
||||
$paidResult->UserId= $infos['commande']['idUser'];
|
||||
if($paidResult->UserId!=$idUser){
|
||||
$this->view->message=__LINE__;
|
||||
return false;
|
||||
}
|
||||
$paidResult->UserName = $infos['commande']['nom'].' '.$infos['commande']['prenom'];
|
||||
$paidResult->ClientName = $infos['societe']['NOM'];
|
||||
$paidResult->ClientFacDest = $infos['commande']['email'];
|
||||
$paidResult->ClientFacAdr1 = $infos['societe']['ADR_NUMVOIE'].' '.$infos['societe']['ADR_TYPVOIE'].' '.$infos['societe']['ADR_LIBVOIE'];
|
||||
$paidResult->ClientFacAdr2 = $infos['societe']['ADR_CP'].' '.$infos['societe']['ADR_LIBCOM'];
|
||||
$paidResult->ClientFacAdr3 = $infos['societe']['PAYS'];
|
||||
$paidResult->nbCredit = $infos['commande']['nbCredit']*$infos['commande']['valid'];
|
||||
$paidResult->amount = $infos['commande']['amount']*$infos['commande']['valid']/100;
|
||||
$paidResult->amount_ht = $infos['commande']['amount_ht']*$infos['commande']['valid']/100;
|
||||
$paidResult->amount_tva = $infos['commande']['amount_tva']*$infos['commande']['valid']/100;
|
||||
$paidResult->taux_tva = number_format(($infos['commande']['amount_tva']/$infos['commande']['amount_ht'])*100,"0,00 %");
|
||||
$paidResult->idFact= 'PL.'.Date('Y',strtotime($infos['commande']['date_sent'])).sprintf("%1$08d",$infos['commande']['id']);
|
||||
$paidResult->idCmd = $infos['commande']['idCmd'];
|
||||
$paidResult->dateCmd = Date('d/m/Y',strtotime($infos['commande']['date_sent']));
|
||||
$paidResult->numRC=$infos['societe']['NUMRC'];
|
||||
|
||||
$address = $paidResult->UserName . ' ' . $paidResult->UserFirstname . "\n" .
|
||||
/*$address = $paidResult->UserName . ' ' . $paidResult->UserFirstname . "\n" .
|
||||
$paidResult->ClientName ."\n" .
|
||||
$paidResult->ClientFacDest . "\n" .
|
||||
$paidResult->ClientFacAdr1 . "\n" .
|
||||
@ -121,6 +143,7 @@ class Achatclient_InextensoController extends Zend_Controller_Action
|
||||
|
||||
$amount = $paidResult->amount / 100;
|
||||
$amount_ht = $paidResult->amount_ht / 100;
|
||||
*/
|
||||
$logotbl = <<<EOD
|
||||
<img src="http://www.lendopolis.com/images/howto/partners/logo-scores-et-decisions-alt.jpg" width="150">
|
||||
<br />
|
||||
@ -134,14 +157,14 @@ EOD;
|
||||
<th style="text-align: center;background-color:#E6E6FF" colspan="3">Facture</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="text-align: center;background-color:#E6E6FF">N° Facture</th>
|
||||
<th style="text-align: center;background-color:#E6E6FF">Date</th>
|
||||
<th style="text-align: center;background-color:#E6E6FF">N° Client</th>
|
||||
<th style="text-align: center;background-color:#E6E6FF" width="80px">N° Facture</th>
|
||||
<th style="text-align: center;background-color:#E6E6FF" width="70px">Date</th>
|
||||
<th style="text-align: center;background-color:#E6E6FF" width="70px">N° Client</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: right">$paidResult->idCmd</td>
|
||||
<td style="text-align: right">12/03/2017</td>
|
||||
<td style="text-align: right">$paidResult->UserId</td>
|
||||
<td style="text-align: right;font-size:8px;" width="80px">$paidResult->idFact</td>
|
||||
<td style="text-align: right;font-size:8px;" width="70px">$paidResult->dateCmd</td>
|
||||
<td style="text-align: right;font-size:8px;" width="70px">$paidResult->UserId</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
@ -173,14 +196,14 @@ EOD;
|
||||
<tr>
|
||||
<th style="text-align: center;background-color:#E6E6FF">Destinataire</th>
|
||||
</tr>
|
||||
<tr><td>$paidResult->UserName . ' ' . $paidResult->UserFirstname</td></tr>
|
||||
<tr><td>$paidResult->UserName</td></tr>
|
||||
<tr><td>$paidResult->ClientName</td></tr>
|
||||
<tr><td>$paidResult->ClientFacAdr1</td></tr>
|
||||
<tr><td>$paidResult->ClientFacAdr2</td></tr>
|
||||
<tr><td>$paidResult->ClientFacAdr3</td></tr>
|
||||
<tr><td>Tél. : 01 75 43 61 02</td></tr>
|
||||
<tr><td>Contact : compta@scores-decisions.com</td></tr>
|
||||
<tr><td>R.C.S. : 2012B01581 RCS NANTERRE</td></tr>
|
||||
<tr><td>N.I.I. : FR84 494967938</td></tr>
|
||||
<tr><td>Contact : $paidResult->ClientFacDest</td></tr>
|
||||
<tr><td>R.C.S. : $paidResult->numRC</td></tr>
|
||||
<tr><td>N.I.I. : </td></tr>
|
||||
</table>
|
||||
<br />
|
||||
<br />
|
||||
@ -197,7 +220,7 @@ EOD;
|
||||
<th style="text-align: center;background-color:#E6E6FF">Prix H.T.</th>
|
||||
<th style="text-align: center;background-color:#E6E6FF">Total H.T.</th>
|
||||
</tr>
|
||||
<tr><td>$paidResult->DateCmd</td>
|
||||
<tr><td>$paidResult->dateCmd</td>
|
||||
<td>$paidResult->idCmd</td>
|
||||
<td>Abonnement Extranet niveau1</td>
|
||||
<td style="text-align: right;">$paidResult->nbCredit</td>
|
||||
@ -220,17 +243,34 @@ EOD;
|
||||
<th style="text-align: center;background-color:#E6E6FF">Net à payer</th>
|
||||
</tr>
|
||||
<tr><td style="text-align: right;">$paidResult->amount_ht €</td>
|
||||
<td style="text-align: right;">$paidResult->taux_tva</td>
|
||||
<td style="text-align: right;">$paidResult->taux_tva %</td>
|
||||
<td style="text-align: right;">$paidResult->amount_tva €</td>
|
||||
<td style="text-align: right;">$paidResult->amount €</td>
|
||||
<td style="text-align: right;">$paidResult->amount €</td></tr>
|
||||
</table>
|
||||
<br />
|
||||
<br />
|
||||
EOD;
|
||||
$pdf->SetXY(20, 200);
|
||||
$pdf->SetXY(20, 190);
|
||||
$pdf->writeHTML($totaltbl, true, false, false, false, '');
|
||||
|
||||
$footertbl = <<<EOD
|
||||
<table cellspacing="0" cellpadding="1" border="1" width="475" style="font-size:10px;">
|
||||
<tr>
|
||||
<th style="text-align: center;background-color:#E6E6FF;">Mode de paiement</th>
|
||||
<th style="text-align: center;background-color:#E6E6FF;">Date de paiement</th>
|
||||
</tr>
|
||||
<tr><td style="text-align: center;">Paiement en ligne carte bancaire</td>
|
||||
<td style="text-align: center;">$paidResult->dateCmd</td>
|
||||
</tr>
|
||||
</table>
|
||||
EOD;
|
||||
$pdf->SetXY(20, 230);
|
||||
$pdf->writeHTML($footertbl, true, false, false, false, '');
|
||||
$footer = <<<EOD
|
||||
<center><span style="font-size:8px;">Scores & Decisions – Société anonyme par actions simplifiées au capital de 618 450,00 € - SIRET : 494 967 938 00072</span></center>
|
||||
EOD;
|
||||
$pdf->SetXY(20, 280);
|
||||
$pdf->writeHTML($footer, true, false, false, false, '');
|
||||
|
||||
|
||||
// Close and output PDF document
|
||||
$pdf->Output('bill_'.date('YmdHis').'.pdf', 'I');
|
||||
@ -239,9 +279,6 @@ EOD;
|
||||
//}
|
||||
|
||||
}
|
||||
public function testAction(){
|
||||
$tbl=$this->render('billing');
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
@ -57,7 +57,7 @@ Une remarque ? <a href="<?=$this->url(array('controller'=>'index', 'action'=>'co
|
||||
<?php if(isset($this->infos) && isset($this->infos['paid'])):?>
|
||||
<h2 id="achats">Historique de vos achats</h2>
|
||||
<table class="data" style="max-width:90%;">
|
||||
<tr><th></th><th>Date d'achat</th><th>Montant de l'achat</th><th>Nb Crédits</th><th>Statut</th><th>Date de <br>validité des crédits</th></tr>
|
||||
<tr><th></th><th>Date d'achat</th><th>Montant de l'achat</th><th>Nb Crédits</th><th>Statut</th><th>Date de <br>validité des crédits</th><th></th></tr>
|
||||
<?php foreach($this->infos['paid'] as $row):?>
|
||||
<tr><td></td>
|
||||
<td><?=Date('d/m/Y H:i:s',strtotime($row['date_sent']))?></td>
|
||||
@ -65,6 +65,7 @@ Une remarque ? <a href="<?=$this->url(array('controller'=>'index', 'action'=>'co
|
||||
<td class="nbr"><?=$row['nbCredit']?> Credits</td>
|
||||
<td><?=($row['valid']==0?'Annulée':'Enregistrée')?></td>
|
||||
<td><?=($row['valid']==1?Date('d/m/Y',strtotime($row['date_sent'])+365*24*3600):'-')?></td>
|
||||
<td><a href="<?=$this->url(array('module' => 'achatclient','controller' => 'inextenso','action' => 'index', 'id' => $row['id']))?>">Facture</a></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</table>
|
||||
|
@ -0,0 +1,23 @@
|
||||
<style>
|
||||
div .credit{
|
||||
margin-left:25px;
|
||||
}
|
||||
td.nbr{
|
||||
text-align:right;
|
||||
}
|
||||
#message{
|
||||
color:red;
|
||||
font-size:14px;
|
||||
}
|
||||
</style>
|
||||
<div id="center">
|
||||
|
||||
<h1>Votre compte crédits en ligne</h1>
|
||||
|
||||
<h2>Résumé de vos crédits</h2>
|
||||
<div class="credit">
|
||||
<div id="message">Votre demande ne peut aboutir.N'hésitez pas à nous contacter en mentionnant le code erreur : 12-<?=$this->message; ?></div>
|
||||
<a href="<?=$this->url(array('controller'=>'index', 'action'=>'index'))?>">Retour</a>
|
||||
</div>
|
||||
|
||||
</div>
|
10
composer.lock
generated
10
composer.lock
generated
@ -205,16 +205,16 @@
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/psr7",
|
||||
"version": "1.4.1",
|
||||
"version": "1.4.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/psr7.git",
|
||||
"reference": "0d6c7ca039329247e4f0f8f8f6506810e8248855"
|
||||
"reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/psr7/zipball/0d6c7ca039329247e4f0f8f8f6506810e8248855",
|
||||
"reference": "0d6c7ca039329247e4f0f8f8f6506810e8248855",
|
||||
"url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
|
||||
"reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -266,7 +266,7 @@
|
||||
"uri",
|
||||
"url"
|
||||
],
|
||||
"time": "2017-02-27T10:51:17+00:00"
|
||||
"time": "2017-03-20T17:10:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "monolog/monolog",
|
||||
|
@ -25,6 +25,10 @@ return array(
|
||||
'debug' => true,
|
||||
'errorMsg' => array('MSG'),
|
||||
),
|
||||
'getfactinfosCredit' => array(
|
||||
'debug' => true,
|
||||
'errorMsg' => array('MSG'),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user