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


PHP Facture::fetch方法代碼示例

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


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

示例1: 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

示例2: 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

示例3: while

 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
     print '<td align="right">' . price($paiement);
開發者ID:netors,項目名稱:dolibarr,代碼行數:31,代碼來源:paiement.php

示例4: foreach

 // Si texte entoure de parenthese on tente recherche de traduction
 if ($reg[1] && $langs->transnoentitiesnoconv($reg[1]) != $reg[1]) {
     $description = $langs->transnoentitiesnoconv($reg[1]);
 } else {
     $description = $objp->label;
 }
 /*
  * Ajout les liens (societe, company...)
  */
 $links = $acct->get_url($objp->rowid);
 foreach ($links as $key => $val) {
     if ($links[$key]['type'] == 'payment') {
         $paymentstatic->fetch($links[$key]['url_id']);
         $tmparray = $paymentstatic->getBillsArray('');
         foreach ($tmparray as $key => $val) {
             $invoicestatic->fetch($val);
             if ($accountelem) {
                 $accountelem .= ', ';
             }
             $accountelem .= $invoicestatic->ref;
         }
     } elseif ($links[$key]['type'] == 'payment_supplier') {
         $paymentsupplierstatic->fetch($links[$key]['url_id']);
         $tmparray = $paymentsupplierstatic->getBillsArray('');
         foreach ($tmparray as $key => $val) {
             $invoicesupplierstatic->fetch($val);
             if ($accountelem) {
                 $accountelem .= ', ';
             }
             $accountelem .= $invoicesupplierstatic->ref;
         }
開發者ID:Albertopf,項目名稱:prueba,代碼行數:31,代碼來源:export-bank-receipts.php

示例5: addPaymentToBank

 /**
  *      Add a record into bank for payment with links between this bank record and invoices of payment.
  *      All payment properties (this->amount, this->amounts, ...) must have been set first like after a call to create().
  *
  *      @param	User	$user               Object of user making payment
  *      @param  string	$mode               'payment', 'payment_supplier'
  *      @param  string	$label              Label to use in bank record
  *      @param  int		$accountid          Id of bank account to do link with
  *      @param  string	$emetteur_nom       Name of transmitter
  *      @param  string	$emetteur_banque    Name of bank
  *      @param	int		$notrigger			No trigger
  *      @return int                 		<0 if KO, bank_line_id if OK
  */
 function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque, $notrigger = 0)
 {
     global $conf, $langs, $user;
     $error = 0;
     $bank_line_id = 0;
     if (!empty($conf->banque->enabled)) {
         if ($accountid <= 0) {
             $this->error = 'Bad value for parameter accountid';
             dol_syslog(get_class($this) . '::addPaymentToBank ' . $this->error, LOG_ERR);
             return -1;
         }
         $this->db->begin();
         $this->fk_account = $accountid;
         require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
         dol_syslog("{$user->id},{$mode},{$label},{$this->fk_account},{$emetteur_nom},{$emetteur_banque}");
         $acc = new Account($this->db);
         $result = $acc->fetch($this->fk_account);
         $totalamount = $this->amount;
         if (empty($totalamount)) {
             $totalamount = $this->total;
         }
         // For backward compatibility
         if ($mode == 'payment_supplier') {
             $totalamount = -$totalamount;
         }
         // Insert payment into llx_bank
         $bank_line_id = $acc->addline($this->datepaye, $this->paiementid, $label, $totalamount, $this->num_paiement, '', $user, $emetteur_nom, $emetteur_banque);
         // Mise a jour fk_bank dans llx_paiement
         // On connait ainsi le paiement qui a genere l'ecriture bancaire
         if ($bank_line_id > 0) {
             $result = $this->update_fk_bank($bank_line_id);
             if ($result <= 0) {
                 $error++;
                 dol_print_error($this->db);
             }
             // Add link 'payment', 'payment_supplier' in bank_url between payment and bank transaction
             if (!$error) {
                 $url = '';
                 if ($mode == 'payment') {
                     $url = DOL_URL_ROOT . '/compta/paiement/card.php?id=';
                 }
                 if ($mode == 'payment_supplier') {
                     $url = DOL_URL_ROOT . '/fourn/paiement/card.php?id=';
                 }
                 if ($url) {
                     $result = $acc->add_url_line($bank_line_id, $this->id, $url, '(paiement)', $mode);
                     if ($result <= 0) {
                         $error++;
                         dol_print_error($this->db);
                     }
                 }
             }
             // Add link 'company' in bank_url between invoice and bank transaction (for each invoice concerned by payment)
             if (!$error && $label != '(WithdrawalPayment)') {
                 $linkaddedforthirdparty = array();
                 foreach ($this->amounts as $key => $value) {
                     if ($mode == 'payment') {
                         $fac = new Facture($this->db);
                         $fac->fetch($key);
                         $fac->fetch_thirdparty();
                         if (!in_array($fac->thirdparty->id, $linkaddedforthirdparty)) {
                             $result = $acc->add_url_line($bank_line_id, $fac->thirdparty->id, DOL_URL_ROOT . '/comm/card.php?socid=', $fac->thirdparty->name, 'company');
                             if ($result <= 0) {
                                 dol_syslog(get_class($this) . '::addPaymentToBank ' . $this->db->lasterror());
                             }
                             $linkaddedforthirdparty[$fac->thirdparty->id] = $fac->thirdparty->id;
                             // Mark as done for this thirdparty
                         }
                     }
                     if ($mode == 'payment_supplier') {
                         $fac = new FactureFournisseur($this->db);
                         $fac->fetch($key);
                         $fac->fetch_thirdparty();
                         if (!in_array($fac->thirdparty->id, $linkaddedforthirdparty)) {
                             $result = $acc->add_url_line($bank_line_id, $fac->thirdparty->id, DOL_URL_ROOT . '/fourn/card.php?socid=', $fac->thirdparty->name, 'company');
                             if ($result <= 0) {
                                 dol_syslog(get_class($this) . '::addPaymentToBank ' . $this->db->lasterror());
                             }
                             $linkaddedforthirdparty[$fac->thirdparty->id] = $fac->thirdparty->id;
                             // Mark as done for this thirdparty
                         }
                     }
                 }
             }
             if (!$error && !$notrigger) {
                 // Appel des triggers
                 $result = $this->call_trigger('PAYMENT_ADD_TO_BANK', $user);
//.........這裏部分代碼省略.........
開發者ID:Samara94,項目名稱:dolibarr,代碼行數:101,代碼來源:paiement.class.php

示例6: Facture

	$email=$order->client->email;
	$email=(GETPOST("email")?GETPOST("email"):(isValidEmail($email)?$email:''));
	print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="email" size="48" value="'.$email.'"></td></tr>'."\n";
}


// Payment on customer invoice
if (GETPOST("source") == 'invoice')
{
	$found=true;
	$langs->load("bills");

	require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");

	$invoice=new Facture($db);
	$result=$invoice->fetch('',$_REQUEST["ref"]);
	if ($result < 0)
	{
		$mesg=$invoice->error;
		$error++;
	}
	else
	{
		$result=$invoice->fetch_thirdparty($invoice->socid);
	}

	$amount=$invoice->total_ttc - $invoice->getSommePaiement();
    if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
    $amount=price2num($amount);

	$fulltag='IR='.$invoice->ref.'.TPID='.$invoice->client->id.'.TP='.strtr($invoice->client->nom,"-"," ");
開發者ID:remyyounes,項目名稱:dolibarr,代碼行數:31,代碼來源:newpayment.php

示例7: 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

示例8: foreach

            print ' ('.$langs->transnoentities("InvoiceHasAvoir");
            $i=0;
            foreach($facidavoir as $id)
            {
                if ($i==0) print ' ';
                else print ',';
                $facavoir=new Facture($db);
                $facavoir->fetch($id);
                print $facavoir->getNomUrl(1);
            }
            print ')';
        }
        if ($facidnext > 0)
        {
            $facthatreplace=new Facture($db);
            $facthatreplace->fetch($facidnext);
            print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')';
        }
        print '</td></tr>';

        // Discounts
        print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="5">';
        if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
        else print $langs->trans("CompanyHasNoRelativeDiscount");
        print '. ';
        if ($absolute_discount > 0)
        {
            if ($fac->statut > 0 || $fac->type == 2 || $fac->type == 3)
            {
                if ($fac->statut == 0)
                {
開發者ID:remyyounes,項目名稱:dolibarr,代碼行數:31,代碼來源:prelevement.php

示例9: getInvoicesForThirdParty

/**
 * Get list of invoices for third party
 *
 * @param	array		$authentication		Array of authentication information
 * @param	int			$idthirdparty		Id thirdparty
 * @return	array							Array result
 */
function getInvoicesForThirdParty($authentication, $idthirdparty)
{
    global $db, $conf, $langs;
    dol_syslog("Function: getInvoicesForThirdParty login=" . $authentication['login'] . " idthirdparty=" . $idthirdparty);
    if ($authentication['entity']) {
        $conf->entity = $authentication['entity'];
    }
    // Init and check authentication
    $objectresp = array();
    $errorcode = '';
    $errorlabel = '';
    $error = 0;
    $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
    if ($fuser->societe_id) {
        $socid = $fuser->societe_id;
    }
    // Check parameters
    if (!$error && empty($idthirdparty)) {
        $error++;
        $errorcode = 'BAD_PARAMETERS';
        $errorlabel = 'Parameter id is not provided';
    }
    if (!$error) {
        $linesinvoice = array();
        $sql .= 'SELECT f.rowid as facid, facnumber as ref, ref_ext, type, fk_statut as status, total_ttc, total, tva';
        $sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture as f';
        $sql .= " WHERE f.entity = " . $conf->entity;
        if ($idthirdparty != 'all') {
            $sql .= " AND f.fk_soc = " . $db->escape($idthirdparty);
        }
        $resql = $db->query($sql);
        if ($resql) {
            $num = $db->num_rows($resql);
            $i = 0;
            while ($i < $num) {
                // En attendant remplissage par boucle
                $obj = $db->fetch_object($resql);
                $invoice = new Facture($db);
                $invoice->fetch($obj->facid);
                // Sécurité pour utilisateur externe
                if ($socid && $socid != $invoice->socid) {
                    $error++;
                    $errorcode = 'PERMISSION_DENIED';
                    $errorlabel = $invoice->socid . ' User does not have permission for this request';
                }
                if (!$error) {
                    // Define lines of invoice
                    $linesresp = array();
                    foreach ($invoice->lines as $line) {
                        $linesresp[] = array('id' => $line->rowid, 'type' => $line->product_type, 'total_net' => $line->total_ht, 'total_vat' => $line->total_tva, 'total' => $line->total_ttc, 'vat_rate' => $line->tva_tx, 'qty' => $line->qty, 'product_ref' => $line->product_ref, 'product_label' => $line->product_label, 'product_desc' => $line->product_desc);
                    }
                    // Now define invoice
                    $linesinvoice[] = array('id' => $invoice->id, 'ref' => $invoice->ref, 'ref_ext' => $invoice->ref_ext ? $invoice->ref_ext : '', 'fk_user_author' => $invoice->user_author ? $invoice->user_author : '', 'fk_user_valid' => $invoice->user_valid ? $invoice->user_valid : '', 'date' => $invoice->date ? dol_print_date($invoice->date, 'dayrfc') : '', 'date_due' => $invoice->date_lim_reglement ? dol_print_date($invoice->date_lim_reglement, 'dayrfc') : '', 'date_creation' => $invoice->date_creation ? dol_print_date($invoice->date_creation, 'dayhourrfc') : '', 'date_validation' => $invoice->date_validation ? dol_print_date($invoice->date_creation, 'dayhourrfc') : '', 'date_modification' => $invoice->datem ? dol_print_date($invoice->datem, 'dayhourrfc') : '', 'type' => $invoice->type, 'total_net' => $invoice->total_ht, 'total_vat' => $invoice->total_tva, 'total' => $invoice->total_ttc, 'note_private' => $invoice->note_private ? $invoice->note_private : '', 'note_public' => $invoice->note_public ? $invoice->note_public : '', 'status' => $invoice->statut, 'close_code' => $invoice->close_code ? $invoice->close_code : '', 'close_note' => $invoice->close_note ? $invoice->close_note : '', 'lines' => $linesresp);
                }
                $i++;
            }
            $objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'invoices' => $linesinvoice);
        } else {
            $error++;
            $errorcode = $db->lasterrno();
            $errorlabel = $db->lasterror();
        }
    }
    if ($error) {
        $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
    }
    return $objectresp;
}
開發者ID:LionSystemsSolutions,項目名稱:El-Canelo-ERP,代碼行數:75,代碼來源:server_invoice.php

示例10: Facture

 /**
  * Define array with couple substitution key => substitution value
  *
  * @param   Object			$object             Main object to use as data source
  * @param   Translate		$outputlangs        Lang object to use for output
  * @param   array_key		$array_key	        Name of the key for return array
  * @return	array								Array of substitution
  */
 function get_substitutionarray_object($object, $outputlangs, $array_key = 'object')
 {
     global $conf;
     $sumpayed = '';
     $alreadypayed = '';
     if ($object->element == 'facture') {
         $invoice_source = new Facture($this->db);
         if ($object->fk_facture_source > 0) {
             $invoice_source->fetch($object->fk_facture_source);
         }
         $sumpayed = $object->getSommePaiement();
         $alreadypayed = price($sumpayed, 0, $outputlangs);
     }
     $resarray = array($array_key . '_id' => $object->id, $array_key . '_ref' => $object->ref, $array_key . '_ref_ext' => $object->ref_ext, $array_key . '_ref_customer' => $object->ref_client, $array_key . '_ref_supplier' => !empty($object->ref_fournisseur) ? $object->ref_fournisseur : '', $array_key . '_source_invoice_ref' => $invoice_source->ref, $array_key . '_hour' => dol_print_date($object->date, 'hour'), $array_key . '_date' => dol_print_date($object->date, 'day'), $array_key . '_date_rfc' => dol_print_date($object->date, 'dayrfc'), $array_key . '_date_limit' => !empty($object->date_lim_reglement) ? dol_print_date($object->date_lim_reglement, 'day') : '', $array_key . '_date_end' => !empty($object->fin_validite) ? dol_print_date($object->fin_validite, 'day') : '', $array_key . '_date_creation' => dol_print_date($object->date_creation, 'day'), $array_key . '_date_modification' => !empty($object->date_modification) ? dol_print_date($object->date_modification, 'day') : '', $array_key . '_date_validation' => !empty($object->date_validation) ? dol_print_date($object->date_validation, 'dayhour') : '', $array_key . '_date_delivery_planed' => !empty($object->date_livraison) ? dol_print_date($object->date_livraison, 'day') : '', $array_key . '_date_close' => !empty($object->date_cloture) ? dol_print_date($object->date_cloture, 'dayhour') : '', $array_key . '_payment_mode_code' => $object->mode_reglement_code, $array_key . '_payment_mode' => $outputlangs->transnoentitiesnoconv('PaymentType' . $object->mode_reglement_code) != 'PaymentType' . $object->mode_reglement_code ? $outputlangs->transnoentitiesnoconv('PaymentType' . $object->mode_reglement_code) : $object->mode_reglement, $array_key . '_payment_term_code' => $object->cond_reglement_code, $array_key . '_payment_term' => $outputlangs->transnoentitiesnoconv('PaymentCondition' . $object->cond_reglement_code) != 'PaymentCondition' . $object->cond_reglement_code ? $outputlangs->transnoentitiesnoconv('PaymentCondition' . $object->cond_reglement_code) : $object->cond_reglement, $array_key . '_total_ht_locale' => price($object->total_ht, 0, $outputlangs), $array_key . '_total_vat_locale' => price($object->total_tva, 0, $outputlangs), $array_key . '_total_localtax1_locale' => price($object->total_localtax1, 0, $outputlangs), $array_key . '_total_localtax2_locale' => price($object->total_localtax2, 0, $outputlangs), $array_key . '_total_ttc_locale' => price($object->total_ttc, 0, $outputlangs), $array_key . '_total_discount_ht_locale' => price($object->getTotalDiscount(), 0, $outputlangs), $array_key . '_total_ht' => price2num($object->total_ht), $array_key . '_total_vat' => price2num($object->total_tva), $array_key . '_total_localtax1' => price2num($object->total_localtax1), $array_key . '_total_localtax2' => price2num($object->total_localtax2), $array_key . '_total_ttc' => price2num($object->total_ttc), $array_key . '_total_discount_ht' => price2num($object->getTotalDiscount()), $array_key . '_note_private' => $object->note, $array_key . '_note_public' => $object->note_public, $array_key . '_note' => $object->note_public, $array_key . '_already_payed_locale' => price($alreadypayed, 0, $outputlangs), $array_key . '_remain_to_pay_locale' => price($object->total_ttc - $sumpayed, 0, $outputlangs), $array_key . '_already_payed' => $alreadypayed, $array_key . '_remain_to_pay' => price2num($object->total_ttc - $sumpayed));
     // Add vat by rates
     foreach ($object->lines as $line) {
         // $line->tva_tx format depends on database field accuraty, no reliable. This is kept for backward comaptibility
         if (empty($resarray[$array_key . '_total_vat_' . $line->tva_tx])) {
             $resarray[$array_key . '_total_vat_' . $line->tva_tx] = 0;
         }
         $resarray[$array_key . '_total_vat_' . $line->tva_tx] += $line->total_tva;
         $resarray[$array_key . '_total_vat_locale_' . $line->tva_tx] = price($resarray[$array_key . '_total_vat_' . $line->tva_tx]);
         // $vatformated is vat without not expected chars (so 20, or 8.5 or 5.99 for example)
         $vatformated = vatrate($line->tva_tx);
         if (empty($resarray[$array_key . '_total_vat_' . $vatformated])) {
             $resarray[$array_key . '_total_vat_' . $vatformated] = 0;
         }
         $resarray[$array_key . '_total_vat_' . $vatformated] += $line->total_tva;
         $resarray[$array_key . '_total_vat_locale_' . $vatformated] = price($resarray[$array_key . '_total_vat_' . $vatformated]);
     }
     // Retrieve extrafields
     if (is_array($object->array_options) && count($object->array_options)) {
         $extrafieldkey = $object->element;
         require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
         $extrafields = new ExtraFields($this->db);
         $extralabels = $extrafields->fetch_name_optionals_label($extrafieldkey, true);
         $object->fetch_optionals($object->id, $extralabels);
         $resarray = $this->fill_substitutionarray_with_extrafields($object, $resarray, $extrafields, $array_key, $outputlangs);
     }
     return $resarray;
 }
開發者ID:NoisyBoy86,項目名稱:Dolibarr_test,代碼行數:49,代碼來源:commondocgenerator.class.php

示例11: array

     $param .= 'search_paymentmode=' . $search_paymentmode;
 }
 $param .= !empty($option) ? "&amp;option=" . $option : "";
 $massactionbutton = $form->selectMassAction('', $massaction ? array() : array('presend' => $langs->trans("SendByMail")));
 $i = 0;
 print '<form method="POST" name="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">' . "\n";
 print_barre_liste($langs->trans('BillsCustomers') . ' ' . ($socid ? ' ' . $soc->name : ''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy.png');
 if ($massaction == 'presend') {
     $langs->load("mails");
     if (!GETPOST('cancel')) {
         $objecttmp = new Facture($db);
         $listofselectedid = array();
         $listofselectedthirdparties = array();
         $listofselectedref = array();
         foreach ($arrayofselected as $toselectid) {
             $result = $objecttmp->fetch($toselectid);
             if ($result > 0) {
                 $listofselectedid[$toselectid] = $toselectid;
                 $thirdpartyid = $objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid;
                 $listofselectedthirdparties[$thirdpartyid] = $thirdpartyid;
                 $listofselectedref[$thirdpartyid][$toselectid] = $objecttmp->ref;
             }
         }
     }
     print '<input type="hidden" name="massaction" value="confirm_presend">';
     include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
     $formmail = new FormMail($db);
     dol_fiche_head(null, '', '');
     $topicmail = "SendBillRef";
     $modelmail = "facture_send";
     // Cree l'objet formulaire mail
開發者ID:Albertopf,項目名稱:prueba,代碼行數:31,代碼來源:list.php

示例12: GETPOST

// For backward compatibility
$ref = GETPOST('ref', 'alpha');
$lineid = GETPOST('lineid', 'int');
$socid = GETPOST('socid', 'int');
$action = GETPOST('action', 'alpha');
// Security check
if ($user->societe_id) {
    $socid = $user->societe_id;
}
$result = restrictedArea($user, 'facture', $id);
$object = new Facture($db);
/*
 * Ajout d'un nouveau contact
 */
if ($action == 'addcontact' && $user->rights->facture->creer) {
    $result = $object->fetch($id);
    if ($result > 0 && $id > 0) {
        $contactid = GETPOST('userid') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int');
        $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
    }
    if ($result >= 0) {
        Header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
        exit;
    } else {
        if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
            $langs->load("errors");
            $mesg = '<div class="error">' . $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType") . '</div>';
        } else {
            $mesg = '<div class="error">' . $object->error . '</div>';
        }
    }
開發者ID:nrjacker4,項目名稱:crm-php,代碼行數:31,代碼來源:contact.php

示例13: testUpdatePrice

 /**
  * Test function addline and update_price
  *
  * @return 	boolean
  * @see		http://wiki.dolibarr.org/index.php/Draft:VAT_calculation_and_rounding#Standard_usage
  */
 public function testUpdatePrice()
 {
     //$this->sharedFixture
     global $conf, $user, $langs, $db;
     $this->savconf = $conf;
     $this->savuser = $user;
     $this->savlangs = $langs;
     $this->savdb = $db;
     $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0;
     // Two lines of 1.24 give 2.48 HT and 2.72 TTC with standard vat rounding mode
     $localobject = new Facture($this->savdb);
     $localobject->initAsSpecimen('nolines');
     $invoiceid = $localobject->create($user);
     $localobject->addline('Desc', 1.24, 1, 10, 0, 0, 0, 0, '', '', 0, 0, 0, 'HT');
     $localobject->addline('Desc', 1.24, 1, 10, 0, 0, 0, 0, '', '', 0, 0, 0, 'HT');
     $newlocalobject = new Facture($this->savdb);
     $newlocalobject->fetch($invoiceid);
     $this->assertEquals(2.48, $newlocalobject->total_ht, "testUpdatePrice test1");
     $this->assertEquals(0.24, $newlocalobject->total_tva, "testUpdatePrice test2");
     $this->assertEquals(2.72, $newlocalobject->total_ttc, "testUpdatePrice test3");
     // Two lines of 1.24 give 2.48 HT and 2.73 TTC with global vat rounding mode
     $localobject = new Facture($this->savdb);
     $localobject->initAsSpecimen('nolines');
     $invoiceid = $localobject->create($user);
     $localobject->addline('Desc', 1.24, 1, 10, 0, 0, 0, 0, '', '', 0, 0, 0, 'HT');
     $localobject->addline('Desc', 1.24, 1, 10, 0, 0, 0, 0, '', '', 0, 0, 0, 'HT');
     $newlocalobject = new Facture($this->savdb);
     $newlocalobject->fetch($invoiceid);
     $this->assertEquals(2.48, $newlocalobject->total_ht, "testUpdatePrice test4");
     //$this->assertEquals(0.25,$newlocalobject->total_tva);
     //$this->assertEquals(2.73,$newlocalobject->total_ttc);
 }
開發者ID:Samara94,項目名稱:dolibarr,代碼行數:38,代碼來源:PricesTest.php

示例14: PaymentSocialContribution

        $mesg = '<div class="error">' . $paiement->error . '</div>';
        $db->rollback();
    }
}
// Create payment
if ($_REQUEST['action'] == 'confirm_valide' && $_REQUEST['confirm'] == 'yes' && $user->rights->tax->charges->creer) {
    $db->begin();
    $paiement = new PaymentSocialContribution($db);
    $paiement->id = $_REQUEST['id'];
    if ($paiement->valide() > 0) {
        $db->commit();
        $factures = array();
        // TODO Get all id of invoices linked to this payment
        foreach ($factures as $id) {
            $fac = new Facture($db);
            $fac->fetch($id);
            $outputlangs = $langs;
            if (!empty($_REQUEST['lang_id'])) {
                $outputlangs = new Translate("", $conf);
                $outputlangs->setDefaultLang($_REQUEST['lang_id']);
            }
            if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
                facture_pdf_create($db, $fac, $fac->modelpdf, $outputlangs, $hookmanager);
            }
        }
        Header('Location: fiche.php?id=' . $paiement->id);
        exit;
    } else {
        $mesg = '<div class="error">' . $paiement->error . '</div>';
        $db->rollback();
    }
開發者ID:nrjacker4,項目名稱:crm-php,代碼行數:31,代碼來源:fiche.php

示例15: rebuild_merge_pdf


//.........這裏部分代碼省略.........
        } else {
            $sqlwhere .= " AND";
        }
        $sqlwhere .= ' f.fk_soc IN (' . join(',', $thirdpartiesid) . ')';
    }
    if ($sqlwhere) {
        $sql .= $sqlwhere;
    }
    if ($sqlorder) {
        $sql .= $sqlorder;
    }
    //print $sql; exit;
    dol_syslog("scripts/invoices/rebuild_merge.php:", LOG_DEBUG);
    if ($usestdout) {
        print '--- start' . "\n";
    }
    // Start of transaction
    //$db->begin();
    $error = 0;
    $result = 0;
    $files = array();
    // liste les fichiers
    dol_syslog("scripts/invoices/rebuild_merge.php", LOG_DEBUG);
    if ($resql = $db->query($sql)) {
        $num = $db->num_rows($resql);
        $cpt = 0;
        $oldemail = '';
        $message = '';
        $total = '';
        if ($num) {
            // First loop on each resultset to build PDF
            // -----------------------------------------
            while ($cpt < $num) {
                $obj = $db->fetch_object($resql);
                $fac = new Facture($db);
                $result = $fac->fetch($obj->rowid);
                if ($result > 0) {
                    $outputlangs = $langs;
                    if (!empty($newlangid)) {
                        if ($outputlangs->defaultlang != $newlangid) {
                            $outputlangs = new Translate("", $conf);
                            $outputlangs->setDefaultLang($newlangid);
                        }
                    }
                    $filename = $conf->facture->dir_output . '/' . $fac->ref . '/' . $fac->ref . '.pdf';
                    if ($regenerate || !dol_is_file($filename)) {
                        if ($usestdout) {
                            print "Build PDF for invoice " . $obj->facnumber . " - Lang = " . $outputlangs->defaultlang . "\n";
                        }
                        $result = $fac->generateDocument($regenerate ? $regenerate : $fac->modelpdf, $outputlangs);
                    } else {
                        if ($usestdout) {
                            print "PDF for invoice " . $obj->facnumber . " already exists\n";
                        }
                    }
                    // Add file into files array
                    $files[] = $filename;
                }
                if ($result <= 0) {
                    $error++;
                    if ($usestdout) {
                        print "Error: Failed to build PDF for invoice " . ($fac->ref ? $fac->ref : ' id ' . $obj->rowid) . "\n";
                    } else {
                        dol_syslog("Failed to build PDF for invoice " . ($fac->ref ? $fac->ref : ' id ' . $obj->rowid), LOG_ERR);
                    }
                }
開發者ID:Samara94,項目名稱:dolibarr,代碼行數:67,代碼來源:invoice2.lib.php


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