当前位置: 首页>>代码示例>>PHP>>正文


PHP FactureFournisseur::set_paid方法代码示例

本文整理汇总了PHP中FactureFournisseur::set_paid方法的典型用法代码示例。如果您正苦于以下问题:PHP FactureFournisseur::set_paid方法的具体用法?PHP FactureFournisseur::set_paid怎么用?PHP FactureFournisseur::set_paid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FactureFournisseur的用法示例。


在下文中一共展示了FactureFournisseur::set_paid方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create

 /**
  *	Create payment in database
  *
  *	@param		User	$user        			Object of creating user
  *	@param		int		$closepaidinvoices   	1=Also close payed invoices to paid, 0=Do nothing more
  *	@return     int         					id of created payment, < 0 if error
  */
 function create($user, $closepaidinvoices = 0)
 {
     global $langs, $conf;
     $error = 0;
     // Clean parameters
     $this->total = 0;
     foreach ($this->amounts as $key => $value) {
         $newvalue = price2num($value, 'MT');
         $this->amounts[$key] = $newvalue;
         $this->total += $newvalue;
     }
     $this->total = price2num($this->total);
     $this->db->begin();
     if ($this->total != 0) {
         $now = dol_now();
         $sql = 'INSERT INTO ' . MAIN_DB_PREFIX . 'paiementfourn (';
         $sql .= 'datec, datep, amount, fk_paiement, num_paiement, note, fk_user_author, fk_bank)';
         $sql .= " VALUES ('" . $this->db->idate($now) . "',";
         $sql .= " '" . $this->db->idate($this->datepaye) . "', '" . $this->total . "', " . $this->paiementid . ", '" . $this->num_paiement . "', '" . $this->db->escape($this->note) . "', " . $user->id . ", 0)";
         dol_syslog("PaiementFourn::create", LOG_DEBUG);
         $resql = $this->db->query($sql);
         if ($resql) {
             $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . 'paiementfourn');
             // Insere tableau des montants / factures
             foreach ($this->amounts as $key => $amount) {
                 $facid = $key;
                 if (is_numeric($amount) && $amount != 0) {
                     $amount = price2num($amount);
                     $sql = 'INSERT INTO ' . MAIN_DB_PREFIX . 'paiementfourn_facturefourn (fk_facturefourn, fk_paiementfourn, amount)';
                     $sql .= ' VALUES (' . $facid . ',' . $this->id . ',\'' . $amount . '\')';
                     $resql = $this->db->query($sql);
                     if ($resql) {
                         // If we want to closed payed invoices
                         if ($closepaidinvoices) {
                             $invoice = new FactureFournisseur($this->db);
                             $invoice->fetch($facid);
                             $paiement = $invoice->getSommePaiement();
                             //$creditnotes=$invoice->getSumCreditNotesUsed();
                             $creditnotes = 0;
                             //$deposits=$invoice->getSumDepositsUsed();
                             $deposits = 0;
                             $alreadypayed = price2num($paiement + $creditnotes + $deposits, 'MT');
                             $remaintopay = price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits, 'MT');
                             if ($remaintopay == 0) {
                                 $result = $invoice->set_paid($user, '', '');
                             } else {
                                 dol_syslog("Remain to pay for invoice " . $facid . " not null. We do nothing.");
                             }
                         }
                     } else {
                         dol_syslog('Paiement::Create Erreur INSERT dans paiement_facture ' . $facid);
                         $error++;
                     }
                 } else {
                     dol_syslog('PaiementFourn::Create Montant non numerique', LOG_ERR);
                 }
             }
             if (!$error) {
                 // Call trigger
                 $result = $this->call_trigger('PAYMENT_SUPPLIER_CREATE', $user);
                 if ($result < 0) {
                     $error++;
                 }
                 // End call triggers
             }
         } else {
             $this->error = $this->db->lasterror();
             $error++;
         }
     } else {
         $this->error = "ErrorTotalIsNull";
         dol_syslog('PaiementFourn::Create Error ' . $this->error, LOG_ERR);
         $error++;
     }
     if ($this->total != 0 && $error == 0) {
         $this->db->commit();
         dol_syslog('PaiementFourn::Create Ok Total = ' . $this->total);
         return $this->id;
     } else {
         $this->db->rollback();
         return -1;
     }
 }
开发者ID:Albertopf,项目名称:prueba,代码行数:90,代码来源:paiementfourn.class.php

示例2: FactureFournisseur

if ($_REQUEST['action'] == 'confirm_deleteproductline' && $_REQUEST['confirm'] == 'yes')
{
    if ($user->rights->fournisseur->facture->creer)
    {
        $facturefourn = new FactureFournisseur($db);
        $facturefourn->fetch($facid);
        $facturefourn->deleteline($_REQUEST['lineid']);
        $_GET['action'] = '';
    }
}

if ($_REQUEST['action'] == 'confirm_paid' && $_REQUEST['confirm'] == 'yes' && $user->rights->fournisseur->facture->creer)
{
    $facturefourn=new FactureFournisseur($db);
    $facturefourn->fetch($_GET['facid']);
    $result=$facturefourn->set_paid($user);
}

// Set supplier ref
if (($_POST['action'] == 'setref_supplier' || $_POST['action'] == 'set_ref_supplier') && $user->rights->fournisseur->facture->creer)
{
    $facturefourn = new FactureFournisseur($db);
    $facturefourn->fetch($facid);
    $result=$facturefourn->set_ref_supplier($user, $_POST['ref_supplier']);
    $_GET['facid']=$facid;
}

// Set supplier ref
if (($_POST['action'] == 'setlabel') && $user->rights->fournisseur->facture->creer)
{
    $facturefourn = new FactureFournisseur($db);
开发者ID:remyyounes,项目名称:dolibarr,代码行数:31,代码来源:fiche.php

示例3: elseif

        $mesg = '<div class="error">' . $object->error . '</div>';
    }
} elseif ($action == 'confirm_delete_line' && $confirm == 'yes' && $user->rights->fournisseur->facture->creer) {
    $object->fetch($id);
    $ret = $object->deleteline(GETPOST('lineid'));
    if ($ret > 0) {
        header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id);
        exit;
    } else {
        $mesg = '<div class="error">' . $object->error . '</div>';
        /* Fix bug 1485 : Reset action to avoid asking again confirmation on failure */
        $action = '';
    }
} elseif ($action == 'confirm_paid' && $confirm == 'yes' && $user->rights->fournisseur->facture->creer) {
    $object->fetch($id);
    $result = $object->set_paid($user);
    if ($result < 0) {
        setEventMessage($object->error, 'errors');
    }
}
// Set supplier ref
if ($action == 'setref_supplier' && $user->rights->fournisseur->commande->creer) {
    $result = $object->setValueFrom('ref_supplier', GETPOST('ref_supplier', 'alpha'));
    if ($result < 0) {
        dol_print_error($db, $object->error);
    }
}
// conditions de reglement
if ($action == 'setconditions' && $user->rights->fournisseur->commande->creer) {
    $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
} else {
开发者ID:LionSystemsSolutions,项目名称:El-Canelo-ERP,代码行数:31,代码来源:fiche.php

示例4: create

	/**
	 *    Create payment in database
	 *    @param      user        			Object of creating user
	 *    @param       closepaidinvoices   	1=Also close payed invoices to paid, 0=Do nothing more
	 *    @return     int         			id of created payment, < 0 if error
	 */
	function create($user,$closepaidinvoices=0)
	{
		global $langs,$conf;

		$error = 0;

		// Clean parameters
		$this->total = 0;
		foreach ($this->amounts as $key => $value)
		{
			$value = price2num($value);
			$val = round($value, 2);
			$this->amounts[$key] = $val;
			$this->total += $val;
		}
		$this->total = price2num($this->total);


		$this->db->begin();

		if ($this->total <> 0) // On accepte les montants negatifs
		{
			$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'paiementfourn (';
			$sql.= 'datec, datep, amount, fk_paiement, num_paiement, note, fk_user_author, fk_bank)';
			$sql.= ' VALUES ('.$this->db->idate(mktime()).',';
			$sql.= " ".$this->db->idate($this->datepaye).", '".$this->total."', ".$this->paiementid.", '".$this->num_paiement."', '".$this->db->escape($this->note)."', ".$user->id.", 0)";

			dol_syslog("PaiementFourn::create sql=".$sql);
			$resql = $this->db->query($sql);
			if ($resql)
			{
				$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'paiementfourn');

				// Insere tableau des montants / factures
				foreach ($this->amounts as $key => $amount)
				{
					$facid = $key;
					if (is_numeric($amount) && $amount <> 0)
					{
						$amount = price2num($amount);
						$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'paiementfourn_facturefourn (fk_facturefourn, fk_paiementfourn, amount)';
						$sql .= ' VALUES ('.$facid.','. $this->id.',\''.$amount.'\')';
						$resql=$this->db->query($sql);
						if ($resql)
						{
							// If we want to closed payed invoices
						    if ($closepaidinvoices)
						    {
						        $invoice=new FactureFournisseur($this->db);
						        $invoice->fetch($facid);
	                            $paiement = $invoice->getSommePaiement();
	                            //$creditnotes=$invoice->getSumCreditNotesUsed();
	                            $creditnotes=0;
	                            //$deposits=$invoice->getSumDepositsUsed();
	                            $deposits=0;
	                            $alreadypayed=price2num($paiement + $creditnotes + $deposits,'MT');
	                            $remaintopay=price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,'MT');
	                            if ($remaintopay == 0)
	                            {
	    					        $result=$invoice->set_paid($user,'','');
	                            }
	                            else dol_syslog("Remain to pay for invoice ".$facid." not null. We do nothing.");
							}
						}
						else
						{
							dol_syslog('Paiement::Create Erreur INSERT dans paiement_facture '.$facid);
							$error++;
						}
						
					}
					else
					{
						dol_syslog('PaiementFourn::Create Montant non numerique',LOG_ERR);
					}
				}

				if (! $error)
				{
		            // Appel des triggers
		            include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
		            $interface=new Interfaces($this->db);
		            $result=$interface->run_triggers('PAYMENT_SUPPLIER_CREATE',$this,$user,$langs,$conf);
					if ($result < 0) { $error++; $this->errors=$interface->errors; }
		            // Fin appel triggers
				}
			}
			else
			{
				$this->error=$this->db->lasterror();
				dol_syslog('PaiementFourn::Create Error '.$this->error, LOG_ERR);
				$error++;
			}
		}
//.........这里部分代码省略.........
开发者ID:remyyounes,项目名称:dolibarr,代码行数:101,代码来源:paiementfourn.class.php


注:本文中的FactureFournisseur::set_paid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。