當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Facture類代碼示例

本文整理匯總了PHP中Facture的典型用法代碼示例。如果您正苦於以下問題:PHP Facture類的具體用法?PHP Facture怎麽用?PHP Facture使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Facture類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: exists

 public function exists(Facture $facture)
 {
     $q = $this->_db->prepare('SELECT COUNT(*) FROM facture WHERE idFacture = :idFacture');
     $q->bindValue(':idFacture', $facture->idFacture(), PDO::PARAM_INT);
     $q->execute();
     return (bool) $q->fetchColumn();
 }
開發者ID:e-Daho,項目名稱:atelier_garage,代碼行數:7,代碼來源:FactureManager.class.php

示例2: loadBox

 /**
  *  Load data into info_box_contents array to show array later.
  *
  *  @param	int		$max        Maximum number of records to load
  *  @return	void
  */
 function loadBox($max = 5)
 {
     global $conf, $user, $langs, $db;
     $this->max = $max;
     include_once DOL_DOCUMENT_ROOT . "/compta/facture/class/facture.class.php";
     $facturestatic = new Facture($db);
     $this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpaidCustomerBills", $max));
     if ($user->rights->facture->lire) {
         $sql = "SELECT s.nom, s.rowid as socid,";
         $sql .= " f.facnumber, f.date_lim_reglement as datelimite,";
         $sql .= " f.amount, f.datef as df,";
         $sql .= " f.paye, f.fk_statut, f.rowid as facid";
         $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s," . MAIN_DB_PREFIX . "facture as f";
         if (!$user->rights->societe->client->voir && !$user->societe_id) {
             $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
         }
         $sql .= " WHERE f.fk_soc = s.rowid";
         $sql .= " AND f.entity = " . $conf->entity;
         $sql .= " AND f.paye = 0";
         $sql .= " AND fk_statut = 1";
         if (!$user->rights->societe->client->voir && !$user->societe_id) {
             $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
         }
         if ($user->societe_id) {
             $sql .= " AND s.rowid = " . $user->societe_id;
         }
         //$sql.= " ORDER BY f.datef DESC, f.facnumber DESC ";
         $sql .= " ORDER BY datelimite ASC, f.facnumber ASC ";
         $sql .= $db->plimit($max, 0);
         $result = $db->query($sql);
         if ($result) {
             $num = $db->num_rows($result);
             $now = dol_now();
             $i = 0;
             $l_due_date = $langs->trans('Late') . ' (' . strtolower($langs->trans('DateEcheance')) . ': %s)';
             while ($i < $num) {
                 $objp = $db->fetch_object($result);
                 $datelimite = $db->jdate($objp->datelimite);
                 $late = '';
                 if ($datelimite < $now - $conf->facture->client->warning_delay) {
                     $late = img_warning(sprintf($l_due_date, dol_print_date($datelimite, 'day')));
                 }
                 $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, 'url' => DOL_URL_ROOT . "/compta/facture.php?facid=" . $objp->facid);
                 $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $objp->facnumber, 'text2' => $late, 'url' => DOL_URL_ROOT . "/compta/facture.php?facid=" . $objp->facid);
                 $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', 'logo' => 'company', 'url' => DOL_URL_ROOT . "/comm/fiche.php?socid=" . $objp->socid);
                 $this->info_box_contents[$i][3] = array('td' => 'align="left"', 'text' => $objp->nom, 'maxlength' => 44, 'url' => DOL_URL_ROOT . "/comm/fiche.php?socid=" . $objp->socid);
                 $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => dol_print_date($datelimite, 'day'));
                 $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', 'text' => $facturestatic->LibStatut($objp->paye, $objp->fk_statut, 3));
                 $i++;
             }
             if ($num == 0) {
                 $this->info_box_contents[$i][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoUnpaidCustomerBills"));
             }
         } else {
             $this->info_box_contents[0][0] = array('td' => 'align="left"', 'maxlength' => 500, 'text' => $db->error() . ' sql=' . $sql);
         }
     } else {
         $this->info_box_contents[0][0] = array('td' => 'align="left"', 'text' => $langs->trans("ReadPermissionNotAllowed"));
     }
 }
開發者ID:nrjacker4,項目名稱:crm-php,代碼行數:66,代碼來源:box_factures_imp.php

示例3: generateCSV

function generateCSV()
{
    global $db, $conf;
    $TFactRef = $_REQUEST['toGenerate'];
    // Création et attribution droits fichier
    $dir = $conf->lcr->dir_output;
    $filename = 'lcr_' . date('YmdHis') . '.csv';
    $f = fopen($dir . '/' . $filename, 'w+');
    chmod($dir . '/' . $filename, 0777);
    $TTitle = array('Code client', 'Raison sociale', 'Adresse 1', 'Adresse 2', 'Code postal', 'Ville', 'Téléphone', 'Référence', 'SIREN', 'RIB', 'Agence', 'Montant', 'Monnaie', 'Accepté', 'Référence', 'Date de création', 'Date d\'échéance');
    fputcsv($f, $TTitle, ';');
    $fact = new Facture($db);
    $s = new Societe($db);
    foreach ($TFactRef as $ref_fact) {
        if ($fact->fetch('', $ref_fact) > 0 && $s->fetch($fact->socid) > 0) {
            $rib = $s->get_all_rib();
            fputcsv($f, array($s->code_client, $s->name, $s->address, '', $s->zip, $s->town, $s->phone, $ref_fact, $s->idprof1, $rib[0]->iban, '', price($fact->total_ttc), 'E', 1, $ref_fact, date('d/m/Y', $fact->date), date('d/m/Y', $fact->date_lim_reglement)), ';');
        }
    }
    fclose($f);
}
開發者ID:ATM-Consulting,項目名稱:dolibarr_module_lcr,代碼行數:21,代碼來源:lcr.lib.php

示例4: delete

 /**
  * Delete invoice
  *
  * @param int   $id Invoice ID
  * @return type
  * 
  * @url	DELETE invoice/{id} 
  */
 function delete($id)
 {
     if (!DolibarrApiAccess::$user->rights->facture->supprimer) {
         throw new RestException(401);
     }
     $result = $this->invoice->fetch($id);
     if (!$result) {
         throw new RestException(404, 'Facture not found');
     }
     if (!DolibarrApi::_checkAccessToResource('facture', $this->facture->id)) {
         throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
     }
     if (!$this->invoice->delete($id)) {
         throw new RestException(500);
     }
     return array('success' => array('code' => 200, 'message' => 'Facture deleted'));
 }
開發者ID:Samara94,項目名稱:dolibarr,代碼行數:25,代碼來源:api_invoice.class.php

示例5: _pagehead

 /**
  *  Show top header of page.
  *
  *  @param	PDF			$pdf     		Object PDF
  *  @param  Object		$object     	Object to show
  *  @param  int	    	$showaddress    0=no, 1=yes
  *  @param  Translate	$outputlangs	Object lang for output
  *  @return	void
  */
 function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
 {
     global $conf, $langs;
     $outputlangs->load("main");
     $outputlangs->load("bills");
     $outputlangs->load("propal");
     $outputlangs->load("companies");
     $default_font_size = pdf_getPDFFontSize($outputlangs);
     pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
     // Show Draft Watermark
     if ($object->statut == 0 && !empty($conf->global->FACTURE_DRAFT_WATERMARK)) {
         pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->FACTURE_DRAFT_WATERMARK);
     }
     $pdf->SetTextColor(0, 0, 60);
     $pdf->SetFont('', 'B', $default_font_size + 3);
     $w = 110;
     $posy = $this->marge_haute;
     $posx = $this->page_largeur - $this->marge_droite - $w;
     $pdf->SetXY($this->marge_gauche, $posy);
     // Logo
     $logo = $conf->mycompany->dir_output . '/logos/' . $this->emetteur->logo;
     if ($this->emetteur->logo) {
         if (is_readable($logo)) {
             $height = pdf_getHeightForLogo($logo);
             $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
             // width=0 (auto)
         } else {
             $pdf->SetTextColor(200, 0, 0);
             $pdf->SetFont('', 'B', $default_font_size - 2);
             $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
             $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
         }
     } else {
         $text = $this->emetteur->name;
         $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
     }
     $pdf->SetFont('', 'B', $default_font_size + 3);
     $pdf->SetXY($posx, $posy);
     $pdf->SetTextColor(0, 0, 60);
     $title = $outputlangs->transnoentities("Invoice");
     if ($object->type == 1) {
         $title = $outputlangs->transnoentities("InvoiceReplacement");
     }
     if ($object->type == 2) {
         $title = $outputlangs->transnoentities("InvoiceAvoir");
     }
     if ($object->type == 3) {
         $title = $outputlangs->transnoentities("InvoiceDeposit");
     }
     if ($object->type == 4) {
         $title = $outputlangs->transnoentities("InvoiceProFormat");
     }
     $pdf->MultiCell($w, 3, $title, '', 'R');
     $pdf->SetFont('', 'B', $default_font_size);
     $posy += 5;
     $pdf->SetXY($posx, $posy);
     $pdf->SetTextColor(0, 0, 60);
     $pdf->MultiCell($w, 4, $outputlangs->transnoentities("Ref") . " : " . $outputlangs->convToOutputCharset($object->ref), '', 'R');
     $posy += 1;
     $pdf->SetFont('', '', $default_font_size - 2);
     if ($object->ref_client) {
         $posy += 4;
         $pdf->SetXY($posx, $posy);
         $pdf->SetTextColor(0, 0, 60);
         $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer") . " : " . $outputlangs->convToOutputCharset($object->ref_client), '', 'R');
     }
     $objectidnext = $object->getIdReplacingInvoice('validated');
     if ($object->type == 0 && $objectidnext) {
         $objectreplacing = new Facture($this->db);
         $objectreplacing->fetch($objectidnext);
         $posy += 3;
         $pdf->SetXY($posx, $posy);
         $pdf->SetTextColor(0, 0, 60);
         $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ReplacementByInvoice") . ' : ' . $outputlangs->convToOutputCharset($objectreplacing->ref), '', 'R');
     }
     if ($object->type == 1) {
         $objectreplaced = new Facture($this->db);
         $objectreplaced->fetch($object->fk_facture_source);
         $posy += 4;
         $pdf->SetXY($posx, $posy);
         $pdf->SetTextColor(0, 0, 60);
         $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ReplacementInvoice") . ' : ' . $outputlangs->convToOutputCharset($objectreplaced->ref), '', 'R');
     }
     if ($object->type == 2 && !empty($object->fk_facture_source)) {
         $objectreplaced = new Facture($this->db);
         $objectreplaced->fetch($object->fk_facture_source);
         $posy += 3;
         $pdf->SetXY($posx, $posy);
         $pdf->SetTextColor(0, 0, 60);
         $pdf->MultiCell($w, 3, $outputlangs->transnoentities("CorrectionInvoice") . ' : ' . $outputlangs->convToOutputCharset($objectreplaced->ref), '', 'R');
     }
//.........這裏部分代碼省略.........
開發者ID:NoisyBoy86,項目名稱:Dolibarr_test,代碼行數:101,代碼來源:pdf_crabe.modules.php

示例6: _

// Copyright (c) 2004-2006 NBI SARL
// Author : Nicolas Bouthors <nbouthors@nbi.fr>
//
// You can use and redistribute this file under the term of the GNU GPL v2.0
//
// $Id: index.php 531 2007-06-13 12:32:31Z thierry $
include "../inc/main.php";
$title = _("Client");
$roles = "manager,accounting,employee,client";
include "../top.php";
$client_role = "client";
$is_client = false;
$User = new User();
$user = $User->getInfo();
$roles = explode(",", $user->role);
$Facture = new Facture();
$total_ca_ht = 0;
$where_clause = "1";
if (isset($_GET['id_client']) and $_GET['id_client'] != "") {
    $where_clause .= " AND webfinance_invoices.id_client=" . $_GET['id_client'];
}
if (isset($_GET['mois']) and $_GET['mois'] != "") {
    $where_clause .= " AND date_format(date_facture, '%Y%m')='" . $_GET['mois'] . "'";
}
if (isset($_GET['type']) and $_GET['type'] != "") {
    switch ($_GET['type']) {
        case "unpaid":
            $where_clause .= " AND is_paye=0";
            break;
        case "paid":
            $where_clause .= " AND is_paye=1";
開發者ID:lopacinski,項目名稱:WebFinance,代碼行數:31,代碼來源:index.php

示例7: while

 print '<td align="center">' . $langs->trans('Date') . '</td>';
 print '<td align="right">' . $langs->trans('AmountTTC') . '</td>';
 print '<td align="right">' . $langs->trans('Received') . '</td>';
 print '<td align="right">' . $langs->trans('RemainderToPay') . '</td>';
 print '<td align="right">' . $langs->trans('PaymentAmount') . '</td>';
 print '<td align="right">&nbsp;</td>';
 print "</tr>\n";
 $var = True;
 $total = 0;
 $totalrecu = 0;
 $totalrecucreditnote = 0;
 $totalrecudeposits = 0;
 while ($i < $num) {
     $objp = $db->fetch_object($resql);
     $var = !$var;
     $invoice = new Facture($db);
     $invoice->fetch($objp->facid);
     $paiement = $invoice->getSommePaiement();
     $creditnotes = $invoice->getSumCreditNotesUsed();
     $deposits = $invoice->getSumDepositsUsed();
     $alreadypayed = price2num($paiement + $creditnotes + $deposits, 'MT');
     $remaintopay = price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits, 'MT');
     print '<tr ' . $bc[$var] . '>';
     print '<td>';
     print $invoice->getNomUrl(1, '');
     print "</td>\n";
     // Date
     print '<td align="center">' . dol_print_date($db->jdate($objp->df), 'day') . "</td>\n";
     // Prix
     print '<td align="right">' . price($objp->total_ttc) . '</td>';
     // Recu
開發者ID:netors,項目名稱:dolibarr,代碼行數:31,代碼來源:paiement.php

示例8: while

$result = $db->query($sql);
if ($result) {
    $num = $db->num_rows($result);
    $i = 0;
    while ($i < $num) {
        $row = $db->fetch_row($result);
        $cgs[$row[0]] = $row[1] . ' ' . $row[2];
        $i++;
    }
}
/*
 * Cr�ation
 *
 */
$form = new Form($db);
$facture_static = new Facture($db);
if ($_GET["id"]) {
    $sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, l.price,";
    $sql .= " l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice,";
    $sql .= " l.date_start as date_start, l.date_end as date_end,";
    $sql .= " l.fk_code_ventilation ";
    $sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as l";
    $sql .= " , " . MAIN_DB_PREFIX . "facture as f";
    $sql .= " WHERE f.rowid = l.fk_facture AND f.fk_statut = 1 AND l.rowid = " . $_GET["id"];
    $result = $db->query($sql);
    if ($result) {
        $num_lignes = $db->num_rows($result);
        $i = 0;
        if ($num_lignes) {
            $objp = $db->fetch_object($result);
            if ($objp->fk_code_ventilation == 0) {
開發者ID:Samara94,項目名稱:dolibarr,代碼行數:31,代碼來源:card.php

示例9: loadBox

	/**
	 *      \brief      Charge les donnees en memoire pour affichage ulterieur
	 *      \param      $max        Nombre maximum d'enregistrements a charger
	 */
	function loadBox($max=5)
	{
		global $conf, $user, $langs, $db;

		$this->max=$max;

		include_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
		$facturestatic=new Facture($db);

		$text = $langs->trans("BoxTitleLastCustomerBills",$max);
		$this->info_box_head = array(
				'text' => $text,
				'limit'=> dol_strlen($text)
		);

		if ($user->rights->facture->lire)
		{
			$sql = "SELECT f.rowid as facid, f.facnumber, f.type, f.amount, f.datef as df";
			$sql.= ", f.paye, f.fk_statut, f.datec, f.tms";
			$sql.= ", s.nom, s.rowid as socid";
			$sql.= ", f.date_lim_reglement as datelimite";
			$sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
			if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
			$sql.= ")";
			$sql.= " WHERE f.fk_soc = s.rowid";
			$sql.= " AND s.entity = ".$conf->entity;
			if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
			if($user->societe_id)	$sql.= " AND s.rowid = ".$user->societe_id;
			$sql.= " ORDER BY f.tms DESC";
			$sql.= $db->plimit($max, 0);

			$result = $db->query($sql);
			if ($result)
			{
				$num = $db->num_rows($result);
				$now=gmmktime();

				$i = 0;
				$l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateEcheance')).': %s)';

				while ($i < $num)
				{
					$objp = $db->fetch_object($result);
					$datelimite=$db->jdate($objp->datelimite);
					$datec=$db->jdate($objp->datec);

					$picto='bill';
					if ($objp->type == 1) $picto.='r';
					if ($objp->type == 2) $picto.='a';
					$late = '';
					if ($objp->paye == 0 && ($objp->fk_statut != 2 && $objp->fk_statut != 3) && $datelimite < ($now - $conf->facture->client->warning_delay)) { $late = img_warning(sprintf($l_due_date,dol_print_date($datelimite,'day')));}

					$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
                    'logo' => $picto,
                    'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid);

					$this->info_box_contents[$i][1] = array('td' => 'align="left"',
                    'text' => $objp->facnumber,
                    'text2'=> $late,
                    'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid);

					$this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"',
                    'logo' => 'company',
                    'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);

					$this->info_box_contents[$i][3] = array('td' => 'align="left"',
                    'text' => $objp->nom,
                    'maxlength'=>40,
                    'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);

					$this->info_box_contents[$i][4] = array('td' => 'align="right"',
                    'text' => dol_print_date($datec,'day'),
					);

					$this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"',
                    'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3));

					$i++;
				}

				if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedInvoices"));
			}
			else
			{
				$this->info_box_contents[0][0] = array(	'td' => 'align="left"',
    	        										'maxlength'=>500,
	            										'text' => ($db->error().' sql='.$sql));
			}

		}
		else {
			$this->info_box_contents[0][0] = array('td' => 'align="left"',
            'text' => $langs->trans("ReadPermissionNotAllowed"));
		}
	}
開發者ID:remyyounes,項目名稱:dolibarr,代碼行數:99,代碼來源:box_factures.php

示例10: recup_historique

 public function recup_historique()
 {
     $requete = $this->_db->prepare('select * from facture where idutil=:idutil and valider=:valider');
     $requete->execute(array(':idutil' => $_SESSION['id'], ':valider' => 1));
     $results = $requete->fetchAll();
     $tabobject = array();
     if (empty($results)) {
         return false;
     }
     foreach ($results as $result) {
         $mafacture = new Facture();
         $mafacture->setId($result['id'])->setIdutil($result['idutil'])->setDate($result['date'])->setValider($result['valider']);
         array_push($tabobject, $mafacture);
         // Push l'objet $article dans le tableau $tabobject
     }
     return $tabobject;
 }
開發者ID:FMagnoux,項目名稱:Catalogue,代碼行數:17,代碼來源:FactureManager.php

示例11: create

 /**
  * 	Create a predefined invoice
  *
  * 	@param		User	$user		User object
  * 	@param		int		$facid		Id of source invoice
  *	@return		int					<0 if KO, id of invoice if OK
  */
 function create($user, $facid)
 {
     global $conf, $langs;
     $error = 0;
     $now = dol_now();
     // Clean parameters
     $this->titre = trim($this->titre);
     // Validate parameters
     if (empty($this->titre)) {
         $this->error = $langs->trans("ErrorFieldRequired", $langs->trans("Title"));
         return -3;
     }
     $this->db->begin();
     // Charge facture modele
     $facsrc = new Facture($this->db);
     $result = $facsrc->fetch($facid);
     if ($result > 0) {
         // On positionne en mode brouillon la facture
         $this->brouillon = 1;
         $sql = "INSERT INTO " . MAIN_DB_PREFIX . "facture_rec (";
         $sql .= "titre";
         $sql .= ", fk_soc";
         $sql .= ", entity";
         $sql .= ", datec";
         $sql .= ", amount";
         $sql .= ", remise";
         $sql .= ", note";
         $sql .= ", fk_user_author";
         $sql .= ", fk_projet";
         $sql .= ", fk_cond_reglement";
         $sql .= ", fk_mode_reglement";
         $sql .= ") VALUES (";
         $sql .= "'" . $this->titre . "'";
         $sql .= ", '" . $facsrc->socid . "'";
         $sql .= ", " . $conf->entity;
         $sql .= ", " . $this->db->idate($now);
         $sql .= ", '" . $facsrc->amount . "'";
         $sql .= ", '" . $facsrc->remise . "'";
         $sql .= ", '" . $this->db->escape($this->note) . "'";
         $sql .= ", '" . $user->id . "'";
         $sql .= ", " . ($facsrc->fk_project ? "'" . $facsrc->fk_project . "'" : "null");
         $sql .= ", '" . $facsrc->cond_reglement_id . "'";
         $sql .= ", '" . $facsrc->mode_reglement_id . "'";
         $sql .= ")";
         if ($this->db->query($sql)) {
             $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "facture_rec");
             /*
              * Lines
              */
             $num = count($facsrc->lines);
             for ($i = 0; $i < $num; $i++) {
                 $result_insert = $this->addline($this->id, $facsrc->lines[$i]->desc, $facsrc->lines[$i]->subprice, $facsrc->lines[$i]->qty, $facsrc->lines[$i]->tva_tx, $facsrc->lines[$i]->fk_product, $facsrc->lines[$i]->remise_percent, 'HT', 0, '', 0, $facsrc->lines[$i]->product_type, $facsrc->lines[$i]->rang, $facsrc->lines[$i]->special_code);
                 if ($result_insert < 0) {
                     $error++;
                 }
             }
             if ($error) {
                 $this->db->rollback();
             } else {
                 $this->db->commit();
                 return $this->id;
             }
         } else {
             $this->error = $this->db->error() . ' sql=' . $sql;
             $this->db->rollback();
             return -2;
         }
     } else {
         $this->db->rollback();
         return -1;
     }
 }
開發者ID:nrjacker4,項目名稱:crm-php,代碼行數:79,代碼來源:facture-rec.class.php

示例12: foreach

    $result = $bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET);
    if ($result < 0) {
        $mesg = '<div class="error">' . $bprev->error . '</div>';
    }
    if ($result == 0) {
        $mesg = '<div class="error">' . $langs->trans("NoInvoiceCouldBeWithdrawed") . '</div>';
        foreach ($bprev->invoice_in_error as $key => $val) {
            $mesg .= $val . "<br>\n";
        }
    }
}
/*
 * View
 */
$thirdpartystatic = new Societe($db);
$invoicestatic = new Facture($db);
$bprev = new BonPrelevement($db);
llxHeader('', $langs->trans("NewStandingOrder"));
if (prelevement_check_config() < 0) {
    $langs->load("errors");
    print '<div class="error">';
    print $langs->trans("ErrorModuleSetupNotComplete");
    print '</div>';
}
/*$h=0;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/create.php';
$head[$h][1] = $langs->trans("NewStandingOrder");
$head[$h][2] = 'payment';
$hselected = 'payment';
$h++;
開發者ID:Samara94,項目名稱:dolibarr,代碼行數:30,代碼來源:create.php

示例13: Facture

         } else {
             $error++;
             $errmsg = $acct->error;
             $errmsgs = $acct->errors;
         }
     } else {
         $error++;
         $errmsg = $acct->error;
         $errmsgs = $acct->errors;
     }
 }
 // If option choosed, we create invoice
 if ($option == 'bankviainvoice' && $accountid || $option == 'invoiceonly') {
     require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
     require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/paymentterm.class.php';
     $invoice = new Facture($db);
     $customer = new Societe($db);
     if (!$error) {
         if (!($object->fk_soc > 0)) {
             $langs->load("errors");
             $errmsg = $langs->trans("ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst");
             $error++;
         }
     }
     if (!$error) {
         $result = $customer->fetch($object->fk_soc);
         if ($result <= 0) {
             $errmsg = $customer->error;
             $errmsgs = $acct->errors;
             $error++;
         }
開發者ID:Albertopf,項目名稱:prueba,代碼行數:31,代碼來源:card_subscriptions.php

示例14: must_login

must_login();
if (!isset($_GET['id_client']) or !isset($_GET['id_invoice'])) {
    echo "Missing arguments";
    exit;
}
if (!is_numeric($_GET['id_client']) or !is_numeric($_GET['id_invoice'])) {
    echo "Wrong arguments";
    exit;
}
$Client = new Client();
# check client and invoice
if (!$Client->exists($_GET['id_client'])) {
    echo _("This client doesn't exist");
    exit;
}
$Invoice = new Facture();
if ($Invoice->exists($_GET['id_invoice'])) {
    $inv = $Invoice->getInfos($_GET['id_invoice']);
    if ($inv->id_client != $_GET['id_client']) {
        echo _("This invoice isn't yours!");
        exit;
    }
    $Client = new Client($_GET['id_client']);
}
#site
$result = mysql_query("SELECT value FROM webfinance_pref WHERE type_pref='societe' AND owner=-1") or wf_mysqldie();
list($value) = mysql_fetch_array($result);
mysql_free_result($result);
$company = unserialize(base64_decode($value));
$site = "webfinance.dev.jexiste.org";
if (!empty($company->wf_url) and strlen($company->wf_url) > 3) {
開發者ID:lopacinski,項目名稱:WebFinance,代碼行數:31,代碼來源:index.php

示例15: validate

 /**
  * Tag invoice as validated + call trigger BILL_VALIDATE
  * Object must have lines loaded with fetch_lines
  *
  * @param	User	$user           Object user that validate
  * @param   string	$force_number	Reference to force on invoice
  * @param	int		$idwarehouse	Id of warehouse to use for stock decrease
  * @return	int						<0 if KO, >0 if OK
  */
 function validate($user, $force_number = '', $idwarehouse = 0)
 {
     global $conf, $langs;
     require_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php";
     $now = dol_now();
     $error = 0;
     dol_syslog(get_class($this) . '::validate user=' . $user->id . ', force_number=' . $force_number . ', idwarehouse=' . $idwarehouse, LOG_WARNING);
     // Check parameters
     if (!$this->brouillon) {
         dol_syslog(get_class($this) . "::validate no draft status", LOG_WARNING);
         return 0;
     }
     if (!$user->rights->facture->valider) {
         $this->error = 'Permission denied';
         dol_syslog(get_class($this) . "::validate " . $this->error, LOG_ERR);
         return -1;
     }
     $this->db->begin();
     $this->fetch_thirdparty();
     $this->fetch_lines();
     // Check parameters
     if ($this->type == 1) {
         // Controle que facture source connue
         if ($this->fk_facture_source <= 0) {
             $this->error = $langs->trans("ErrorFieldRequired", $langs->trans("InvoiceReplacement"));
             $this->db->rollback();
             return -10;
         }
         // Charge la facture source a remplacer
         $facreplaced = new Facture($this->db);
         $result = $facreplaced->fetch($this->fk_facture_source);
         if ($result <= 0) {
             $this->error = $langs->trans("ErrorBadInvoice");
             $this->db->rollback();
             return -11;
         }
         // Controle que facture source non deja remplacee par une autre
         $idreplacement = $facreplaced->getIdReplacingInvoice('validated');
         if ($idreplacement && $idreplacement != $this->id) {
             $facreplacement = new Facture($this->db);
             $facreplacement->fetch($idreplacement);
             $this->error = $langs->trans("ErrorInvoiceAlreadyReplaced", $facreplaced->ref, $facreplacement->ref);
             $this->db->rollback();
             return -12;
         }
         $result = $facreplaced->set_canceled($user, 'replaced', '');
         if ($result < 0) {
             $this->error = $facreplaced->error;
             $this->db->rollback();
             return -13;
         }
     }
     // Define new ref
     if ($force_number) {
         $num = $force_number;
     } else {
         if (preg_match('/^[\\(]?PROV/i', $this->ref)) {
             if (!empty($conf->global->FAC_FORCE_DATE_VALIDATION)) {
                 $this->date = dol_now();
                 $this->date_lim_reglement = $this->calculate_date_lim_reglement();
             }
             $num = $this->getNextNumRef($this->client);
         } else {
             $num = $this->ref;
         }
     }
     if ($num) {
         $this->update_price(1);
         // Validate
         $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture';
         $sql .= " SET facnumber='" . $num . "', fk_statut = 1, fk_user_valid = " . $user->id . ", date_valid = '" . $this->db->idate($now) . "'";
         if (!empty($conf->global->FAC_FORCE_DATE_VALIDATION)) {
             $sql .= ', datef=' . $this->db->idate($this->date);
             $sql .= ', date_lim_reglement=' . $this->db->idate($this->date_lim_reglement);
         }
         $sql .= ' WHERE rowid = ' . $this->id;
         dol_syslog(get_class($this) . "::validate sql=" . $sql);
         $resql = $this->db->query($sql);
         if (!$resql) {
             dol_syslog(get_class($this) . "::validate Echec update - 10 - sql=" . $sql, LOG_ERR);
             dol_print_error($this->db);
             $error++;
         }
         // On verifie si la facture etait une provisoire
         if (!$error && preg_match('/^[\\(]?PROV/i', $this->ref)) {
             // La verif qu'une remise n'est pas utilisee 2 fois est faite au moment de l'insertion de ligne
         }
         if (!$error) {
             // Define third party as a customer
             $result = $this->client->set_as_client();
             // Si active on decremente le produit principal et ses composants a la validation de facture
//.........這裏部分代碼省略.........
開發者ID:nrjacker4,項目名稱:crm-php,代碼行數:101,代碼來源:facture.class.php


注:本文中的Facture類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。