本文整理汇总了PHP中dol_getIdFromCode函数的典型用法代码示例。如果您正苦于以下问题:PHP dol_getIdFromCode函数的具体用法?PHP dol_getIdFromCode怎么用?PHP dol_getIdFromCode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dol_getIdFromCode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: price2num
if ($result <= 0) {
$errmsg = $invoice->error;
$errmsgs = $invoice->errors;
$error++;
}
}
// Add payment onto invoice
if ($option == 'bankviainvoice' && $accountid) {
require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
$amounts[$invoice->id] = price2num($cotisation);
$paiement = new Paiement($db);
$paiement->datepaye = $paymentdate;
$paiement->amounts = $amounts;
$paiement->paiementid = dol_getIdFromCode($db, $operation, 'c_paiement');
$paiement->num_paiement = $num_chq;
$paiement->note = $label;
if (!$error) {
// Create payment line for invoice
$paiement_id = $paiement->create($user);
if (!$paiement_id > 0) {
$errmsg = $paiement->error;
$errmsgs = $paiement->errors;
$error++;
}
}
if (!$error) {
// Add transaction into bank account
$bank_line_id = $paiement->addPaymentToBank($user, 'payment', '(SubscriptionPayment)', $accountid, $emetteur_nom, $emetteur_banque);
if (!($bank_line_id > 0)) {
示例2: dol_getIdFromCode
break;
case 'ESP':
$mode_reglement_id = dol_getIdFromCode($db, 'LIQ', 'c_paiement');
$cond_reglement_id = 0;
$note .= $langs->trans("Cash") . "\n";
$note .= $langs->trans("Received") . ' : ' . $obj_facturation->montantEncaisse() . " " . $conf->currency . "\n";
$note .= $langs->trans("Rendu") . ' : ' . $obj_facturation->montantRendu() . " " . $conf->currency . "\n";
$note .= "\n";
$note .= '--------------------------------------' . "\n\n";
break;
case 'CB':
$mode_reglement_id = dol_getIdFromCode($db, 'CB', 'c_paiement');
$cond_reglement_id = 0;
break;
case 'CHQ':
$mode_reglement_id = dol_getIdFromCode($db, 'CHQ', 'c_paiement');
$cond_reglement_id = 0;
break;
}
if (empty($mode_reglement_id)) {
$mode_reglement_id = 0;
}
// If mode_reglement_id not found
if (empty($cond_reglement_id)) {
$cond_reglement_id = 0;
}
// If cond_reglement_id not found
$note .= $_POST['txtaNotes'];
dol_syslog("obj_facturation->getSetPaymentMode()=" . $obj_facturation->getSetPaymentMode() . " mode_reglement_id=" . $mode_reglement_id . " cond_reglement_id=" . $cond_reglement_id);
$error = 0;
$db->begin();
示例3: Cash
<?php
echo '<tr><td></td></tr>';
echo '<tr><td></td></tr>';
$terminal = new Cash($db);
$terminal->fetch($object->fk_cash);
$pay = $object->getSommePaiement();
if ($object->customer_pay > $pay) {
$pay = $object->customer_pay;
}
$diff_payment = $object->total_ttc - $pay;
$listofpayments = $object->getListOfPayments();
foreach ($listofpayments as $paym) {
if ($paym['type'] != 'LIQ') {
echo '<tr><th nowrap="nowrap">' . $terminal->select_Paymentname(dol_getIdFromCode($db, $paym['type'], 'c_paiement')) . '</th><td nowrap="nowrap">' . price($paym['amount'], "", "", "", "", 2) . " " . $langs->trans(currency_name($conf->currency)) . "</td></tr>";
} else {
echo '<tr><th nowrap="nowrap">' . $terminal->select_Paymentname(dol_getIdFromCode($db, $paym['type'], 'c_paiement')) . '</th><td nowrap="nowrap">' . price($paym['amount'] - ($diff_payment < 0 ? $diff_payment : 0), "", "", "", "", 2) . " " . $langs->trans(currency_name($conf->currency)) . "</td></tr>";
}
}
echo '<tr><th nowrap="nowrap">' . ($diff_payment < 0 ? $langs->trans("CustomerRet") : $langs->trans("CustomerDeb")) . '</th><td nowrap="nowrap">' . price(abs($diff_payment), "", "", "", "", 2) . " " . $langs->trans(currency_name($conf->currency)) . "</td></tr>";
?>
</table>
<div class="note"><p><?php
print $conf->global->POS_PREDEF_MSG;
?>
</p></div>
<script type="text/javascript">
window.print();
示例4: fillMailFactureBody
//.........这里部分代码省略.........
$subtotal[$line->tva_tx] += $line->total_ht;
$subtotaltva[$line->tva_tx] += $line->total_tva;
if (!empty($line->total_localtax1)) {
$localtax1 = $line->localtax1_tx;
}
if (!empty($line->total_localtax2)) {
$localtax2 = $line->localtax2_tx;
}
}
} else {
$message .= $langs->transnoentities("ErrNoArticles") . "\n";
}
$message .= $langs->transnoentities("TotalTTC") . ":\t" . price($facture->total_ttc) . " " . $langs->trans(currency_name($conf->currency)) . "\n";
$message .= "\n" . $langs->trans("TotalHT") . "\t" . $langs->trans("VAT") . "\t" . $langs->trans("TotalVAT") . "\n";
if (!empty($subtotal)) {
foreach ($subtotal as $totkey => $totval) {
if ($tvakey > 0) {
$message .= price($subtotal[$totkey], "", "", "", "", 2) . "\t\t\t" . price($totkey, "", "", "", "", 2) . "%\t" . price($subtotaltva[$totkey], "", "", "", "", 2) . "\n";
}
}
}
$message .= "-------------------------------\n";
$message .= price($facture->total_ht, "", "", "", "", 2) . "\t\t\t----\t" . price($facture->total_tva, "", "", "", "", 2) . "\n";
if ($facture->total_localtax1 != 0) {
$message .= $langs->transcountrynoentities("TotalLT1", $mysoc->country_code) . " " . price($localtax1, "", "", "", "", 2) . "%\t" . price($facture->total_localtax1, "", "", "", "", 2) . " " . $langs->trans(currency_name($conf->currency)) . "\n";
}
if ($facture->total_localtax2 != 0) {
$message .= $langs->transcountrynoentities("TotalLT2", $mysoc->country_code) . " " . price($localtax2, "", "", "", "", 2) . "%\t" . price($facture->total_localtax2, "", "", "", "", 2) . " " . $langs->trans(currency_name($conf->currency)) . "\n";
}
$message .= "\n\n";
$terminal = new Cash($db);
$sql = 'SELECT fk_cash, customer_pay FROM ' . MAIN_DB_PREFIX . 'pos_facture WHERE fk_facture = ' . $facture->id;
$resql = $db->query($sql);
$obj = $db->fetch_object($resql);
$customer_pay = $obj->customer_pay;
$terminal->fetch($obj > fk_cash);
if (!empty($conf->rewards->enabled)) {
$rewards = new Rewards($db);
$points = $rewards->getInvoicePoints($facture->id);
}
if ($facture->type == 0) {
$pay = $facture->getSommePaiement();
if (!empty($conf->rewards->enabled)) {
$usepoints = abs($rewards->getInvoicePoints($facture->id, 1));
$moneypoints = abs($usepoints * $conf->global->REWARDS_DISCOUNT);
//falta fer algo per aci
if ($customer_pay > $pay - $moneypoints) {
$pay = $customer_pay;
} else {
$pay = $pay - $moneypoints;
}
} else {
if ($customer_pay > $pay) {
$pay = $customer_pay;
}
}
}
if ($facture->type == 2) {
$customer_pay = $customer_pay * -1;
$pay = $facture->getSommePaiement();
if (!empty($conf->rewards->enabled)) {
$usepoints = abs($rewards->getInvoicePoints($facture->id, 1));
$moneypoints = abs($usepoints * $conf->global->REWARDS_DISCOUNT);
//falta fer algo per aci
if ($customer_pay > $pay - $moneypoints) {
$pay = $customer_pay;
} else {
$pay = $pay - $moneypoints;
}
} else {
if ($customer_pay > $pay) {
$pay = $customer_pay;
}
}
}
$diff_payment = $facture->total_ttc - $moneypoints - $pay;
$listofpayments = $facture->getListOfPayments();
foreach ($listofpayments as $paym) {
if ($paym['type'] != 'PNT') {
if ($paym['type'] != 'LIQ') {
$message .= $terminal->select_Paymentname(dol_getIdFromCode($db, $paym['type'], 'c_paiement')) . "\t" . price($paym['amount'], "", "", "", "", 2) . " " . $langs->trans(currency_name($conf->currency)) . "\n";
} else {
$message .= $terminal->select_Paymentname(dol_getIdFromCode($db, $paym['type'], 'c_paiement')) . "\t" . price($paym['amount'] - ($diff_payment < 0 ? $diff_payment : 0), "", "", "", "", 2) . " " . $langs->trans(currency_name($conf->currency)) . "\n";
}
}
}
if (!empty($conf->rewards->enabled)) {
if ($moneypoints > 0) {
$message .= $usepoints . " " . $langs->trans("Points") . "\t" . price($moneypoints, "", "", "", "", 2) . " " . $langs->trans(currency_name($conf->currency)) . "\n";
}
}
$message .= ($diff_payment < 0 ? $langs->trans("CustomerRet") : $langs->trans("CustomerDeb")) . "\t" . price(abs($diff_payment), "", "", "", "", 2) . " " . $langs->trans(currency_name($conf->currency)) . "\n";
if ($points != 0 && !empty($conf->rewards->enabled)) {
$message .= $langs->trans("TotalPointsInvoice") . "\t" . price($points, "", "", "", "", 2) . " " . $langs->trans('Points') . "\n";
$total_points = $rewards->getCustomerPoints($facture->socid);
$message .= $langs->trans("DispoPoints") . "\t" . price($total_points, "", "", "", "", 2) . " " . $langs->trans('Points') . "\n";
}
$message .= $conf->global->POS_PREDEF_MSG;
return $message;
}
示例5: dol_mktime
print ' ';
print '<input type="submit" class="button" name="cancel" value="' . $langs->trans("Cancel") . '">';
print '</div>';
print "</form>";
}
// View or edit
if ($id > 0) {
$result1 = $object->fetch($id);
$result2 = $object->fetch_thirdparty();
$result3 = $object->fetch_contact();
$result4 = $object->fetch_userassigned();
$result5 = $object->fetch_optionals($id, $extralabels);
if ($listUserAssignedUpdated || $donotclearsession) {
$datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]);
$datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]);
$object->fk_action = dol_getIdFromCode($db, GETPOST("actioncode"), 'c_actioncomm');
$object->label = GETPOST("label");
$object->datep = $datep;
$object->datef = $datef;
$object->percentage = $percentage;
$object->priority = GETPOST("priority");
$object->fulldayevent = GETPOST("fullday") ? 1 : 0;
$object->location = GETPOST('location');
$object->socid = GETPOST("socid");
$object->contactid = GETPOST("contactid", 'int');
//$object->societe->id = $_POST["socid"]; // deprecated
//$object->contact->id = $_POST["contactid"]; // deprecated
$object->fk_project = GETPOST("projectid", 'int');
$object->note = GETPOST("note");
}
if ($result1 < 0 || $result2 < 0 || $result3 < 0 || $result4 < 0 || $result5 < 0) {
示例6: _setPayment
function _setPayment($user, $db, $conf, $langs)
{
$TPayment = GETPOST('payment', 'array');
$fk_bank = GETPOST('fk_bank', 'int');
if (empty($fk_bank)) {
if (function_exists('setEventMessages')) {
setEventMessages($langs->transnoentitiesnoconv('ErrorPaymentImportNoBankSelected'), array(), 'errors');
} else {
setEventMessage($langs->transnoentitiesnoconv('ErrorPaymentImportNoBankSelected'), 'errors');
}
return;
}
$mode_reglement = GETPOST('paiementcode', 'alpha');
$TFactureNotFound = $TPaimentError = $TWriteBankFail = array();
$nb_facture_not_found = $nb_payment = $nb_writebank = 0;
foreach ($TPayment as $TInfoPayment) {
$facture_ref = trim($TInfoPayment['facture_ref']);
$rib = trim($TInfoPayment['rib']);
$amount = price2num($TInfoPayment['amount']);
$date_creation = trim($TInfoPayment['date_creation']);
$num_payment = trim($TInfoPayment['num_payment']);
$note = trim($TInfoPayment['note']);
if ($amount <= 0) {
continue;
}
$facture = new Facture($db);
if ($facture->fetch(null, $facture_ref) > 0) {
if ($facture->paye) {
$TFactureAlreadyPaid[] = $langs->transnoentitiesnoconv('paymentimport_warningFactureAlreadyPaid', $facture_ref);
continue;
// Sécurité si jamais la facture est déjà payé on ne saisie pas de nouveau règlement
}
if (!empty($conf->global->PAYMENTIMPORT_FORCE_DATE_TODAY)) {
$datepaye = dol_mktime(date('H'), date('m'), date('s'), date('m'), date('d'), date('Y'));
} else {
$date_creation = explode('/', $date_creation);
$datepaye = dol_mktime(12, 0, 0, $date_creation[1], $date_creation[0], $date_creation[2]);
}
if (empty($mode_reglement)) {
$paiementcode = $facture->mode_reglement_code;
} else {
$paiementcode = $mode_reglement;
}
// Creation of payment line
$paiement = new Paiement($db);
$paiement->datepaye = $datepaye;
$paiement->amounts = array($facture->id => $amount);
// Array with all payments dispatching
$paiement->paiementid = dol_getIdFromCode($db, $paiementcode, 'c_paiement');
$paiement->num_paiement = $num_payment;
$paiement->note = $note;
$paiement_id = $paiement->create($user, 1);
if ($paiement_id > 0) {
$nb_payment++;
$label = '(CustomerInvoicePayment)';
$result = $paiement->addPaymentToBank($user, 'payment', $label, $fk_bank, '', '');
if ($result > 0) {
$nb_writebank++;
} else {
$TWriteBankFail[] = $langs->transnoentitiesnoconv('paymentimport_errorwritebank', $facture_ref);
}
} else {
$TPaimentError[] = $langs->transnoentitiesnoconv('paymentimport_errorpayment', $facture_ref, $rib, $amount);
}
} else {
$TFactureNotFound[] = $langs->transnoentitiesnoconv('paymentimport_errorfactnotfound', $facture_ref);
$nb_facture_not_found++;
}
}
if ($nb_facture_not_found > 0) {
if (function_exists('setEventMessages')) {
setEventMessages($langs->trans('paymentimport_nb_facture_not_found', $nb_facture_not_found), array(), 'errors');
} else {
setEventMessage($langs->trans('paymentimport_nb_facture_not_found', $nb_facture_not_found), 'errors');
}
}
if ($nb_payment > 0) {
if (function_exists('setEventMessages')) {
setEventMessages($langs->trans('paymentimport_nb_payment', $nb_payment), array());
} else {
setEventMessage($langs->trans('paymentimport_nb_payment', $nb_payment));
}
}
if ($nb_writebank > 0) {
if (function_exists('setEventMessages')) {
setEventMessages($langs->trans('paymentimport_nb_writebank', $nb_writebank), array());
} else {
setEventMessage($langs->trans('paymentimport_nb_writebank', $nb_writebank));
}
}
$_SESSION['TFactureNotFound'] = $TFactureNotFound;
$_SESSION['TPaimentError'] = $TPaimentError;
$_SESSION['TWriteBankFail'] = $TWriteBankFail;
$_SESSION['TFactureAlreadyPaid'] = $TFactureAlreadyPaid;
}
示例7: Cash
}
$terminal = new Cash($db);
$terminal->fetch($ticket->fk_cash);
$pay = $ticket->getSommePaiement();
if ($ticket->customer_pay > $pay) {
$pay = $ticket->customer_pay;
}
$diff_payment = $ticket->total_ttc - $pay;
$listofpayments = $ticket->getListOfPayments();
$pays = array();
if (!empty($listofpayments)) {
foreach ($listofpayments as $paym) {
if ($paym['type'] != 'LIQ') {
$paytext = $terminal->select_Paymentname(dol_getIdFromCode($db, $paym['type'], 'c_paiement')) . " " . price($paym['amount'], "", "", "", "", 2) . " " . $langs->trans(currency_name($conf->currency));
} else {
$paytext = $terminal->select_Paymentname(dol_getIdFromCode($db, $paym['type'], 'c_paiement')) . " " . price($paym['amount'] - ($diff_payment < 0 ? $diff_payment : 0), "", "", "", "", 2) . " " . $langs->trans(currency_name($conf->currency));
}
$pays[] = $paytext;
}
} else {
$paytext = "";
$pays[] = $paytext;
}
$json_data['pays_lines'] = $pays;
$json_data['customer_ret'] = ($diff_payment < 0 ? $langs->trans("CustomerRet") : $langs->trans("CustomerDeb")) . " " . price(abs($diff_payment), "", "", "", "", 2) . " " . $langs->trans(currency_name($conf->currency));
$json_data['predef_msg'] = $conf->global->POS_PREDEF_MSG;
}
if ($pending_print[0][0] == "C") {
$json_data = array();
$sql = "select fk_user, date_c, fk_cash, ref";
$sql .= " from " . MAIN_DB_PREFIX . "pos_control_cash";
示例8: dol_print_date
}
print '</td></tr>';
// Statut
print '<tr><td>' . $langs->trans("Status") . '</td><td>' . $object->getLibStatut(4) . '</td></tr>';
// Date start
print '<tr><td>' . $langs->trans("DateStart") . '</td><td>';
print dol_print_date($object->date_start, 'day');
print '</td></tr>';
// Date end
print '<tr><td>' . $langs->trans("DateEnd") . '</td><td>';
print dol_print_date($object->date_end, 'day');
print '</td></tr>';
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
// Opportunity status
print '<tr><td>' . $langs->trans("OpportunityStatus") . '</td><td>';
$code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code');
if ($code) {
print $langs->trans("OppStatus" . $code);
}
print '</td></tr>';
// Opportunity Amount
print '<tr><td>' . $langs->trans("OpportunityAmount") . '</td><td>';
if (strcmp($object->opp_amount, '')) {
print price($object->opp_amount, '', $langs, 0, 0, 0, $conf->currency);
}
print '</td></tr>';
}
// Budget
print '<tr><td>' . $langs->trans("Budget") . '</td><td>';
if (strcmp($object->budget_amount, '')) {
print price($object->budget_amount, '', $langs, 0, 0, 0, $conf->currency);
示例9: dol_getIdFromCode
$("#actioncode").change(function() {
if ($("#actioncode").val() == \'AC_RDV\') $("#dateend").addClass("fieldrequired");
else $("#dateend").removeClass("fieldrequired");
});
})';
print '</script>' . "\n";
}
print '<form name="formaction" action="' . $_SERVER['PHP_SELF'] . '" method="POST">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="donotclearsession" value="1">';
if ($backtopage) {
print '<input type="hidden" name="backtopage" value="' . ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]) . '">';
}
if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
print '<input type="hidden" name="actioncode" value="' . dol_getIdFromCode($db, 'AC_OTH', 'c_actioncomm') . '">';
}
if (GETPOST("actioncode") == 'AC_RDV') {
print_fiche_titre($langs->trans("AddActionRendezVous"));
} else {
print_fiche_titre($langs->trans("AddAnAction"));
}
dol_fiche_head();
print '<table class="border" width="100%">';
// Type of event
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
print '<tr><td width="30%"><span class="fieldrequired">' . $langs->trans("Type") . '</span></b></td><td>';
$formactions->select_type_actions(GETPOST("actioncode") ? GETPOST("actioncode") : $object->type_code, "actioncode", "systemauto");
print '</td></tr>';
}
// Title
示例10: dol_mktime
if ($aphour == -1) {
$aphour = '0';
}
if ($apmin == -1) {
$apmin = '0';
}
if ($p2hour == -1) {
$p2hour = '0';
}
if ($p2min == -1) {
$p2min = '0';
}
$object->fetch($id);
$datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]);
$datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]);
$object->fk_action = dol_getIdFromCode($db, $_POST["actioncode"], 'c_actioncomm');
$object->label = $_POST["label"];
$object->datep = $datep;
$object->datef = $datef;
$object->percentage = $percentage;
$object->priority = $_POST["priority"];
$object->fulldayevent = $_POST["fullday"] ? 1 : 0;
$object->location = GETPOST('location');
$object->societe->id = $_POST["socid"];
$object->contact->id = $_POST["contactid"];
$object->fk_project = $_POST["projectid"];
$object->note = $_POST["note"];
$object->pnote = $_POST["note"];
$object->fk_element = $_POST["fk_element"];
$object->elementtype = $_POST["elementtype"];
if (!$datef && $percentage == 100) {
示例11: rejectCheck
/**
* Check return management
* Reopen linked invoices and create a new negative payment.
*
* @param int $bank_id Id of bank transaction line concerned
* @param date $rejection_date Date to use on the negative payment
* @return int Id of negative payment line created
*/
function rejectCheck($bank_id, $rejection_date)
{
global $db, $user;
$payment = new Paiement($db);
$payment->fetch(0, 0, $bank_id);
$bankline = new AccountLine($db);
$bankline->fetch($bank_id);
/* Conciliation is allowed because when check is returned, a new line is created onto bank transaction log.
if ($bankline->rappro)
{
$this->error='ActionRefusedLineAlreadyConciliated';
return -1;
}*/
$this->db->begin();
// Not conciliated, we can delete it
//$bankline->delete($user); // We delete
$bankaccount = $payment->fk_account;
// Get invoices list to reopen them
$sql = 'SELECT pf.fk_facture, pf.amount';
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'paiement_facture as pf';
$sql .= ' WHERE pf.fk_paiement = ' . $payment->id;
$resql = $db->query($sql);
if ($resql) {
$rejectedPayment = new Paiement($db);
$rejectedPayment->amounts = array();
$rejectedPayment->datepaye = $rejection_date;
$rejectedPayment->paiementid = dol_getIdFromCode($this->db, 'CHQ', 'c_paiement');
$rejectedPayment->num_paiement = $payment->numero;
while ($obj = $db->fetch_object($resql)) {
$invoice = new Facture($db);
$invoice->fetch($obj->fk_facture);
$invoice->set_unpaid($user);
$rejectedPayment->amounts[$obj->fk_facture] = price2num($obj->amount) * -1;
}
$result = $rejectedPayment->create($user);
if ($result > 0) {
// We created a negative payment, we also add the line as bank transaction
$result = $rejectedPayment->addPaymentToBank($user, 'payment', '(CheckRejected)', $bankaccount, '', '');
if ($result > 0) {
$result = $payment->reject();
if ($result > 0) {
$this->db->commit();
return $rejectedPayment->id;
} else {
$this->db->rollback();
return -1;
}
} else {
$this->error = $rejectedPayment->error;
$this->errors = $rejectedPayment->errors;
$this->db->rollback();
return -1;
}
} else {
$this->error = $rejectedPayment->error;
$this->errors = $rejectedPayment->errors;
$this->db->rollback();
return -1;
}
} else {
$this->error = $this->db->lasterror();
$this->db->rollback();
return -1;
}
}
示例12: Cash
<?php
echo '<tr><td></td></tr>';
echo '<tr><td></td></tr>';
$terminal = new Cash($db);
$terminal->fetch($object->fk_cash);
$pay = $object->getSommePaiement();
if ($object->customer_pay > $pay) {
$pay = $object->customer_pay;
}
$diff_payment = $object->total_ttc - $pay;
$listofpayments = $object->getListOfPayments();
foreach ($listofpayments as $paym) {
if ($paym['type'] != 'LIQ') {
echo '<tr><th nowrap="nowrap">' . $terminal->select_Paymentname(dol_getIdFromCode($db, $paym['type'], 'c_paiement')) . '</th><td nowrap="nowrap">' . price($paym['amount'], "", "", "", "", 2) . " Pesos</td></tr>";
} else {
echo '<tr><th nowrap="nowrap">' . $terminal->select_Paymentname(dol_getIdFromCode($db, $paym['type'], 'c_paiement')) . '</th><td nowrap="nowrap">' . price($paym['amount'] - ($diff_payment < 0 ? $diff_payment : 0), "", "", "", "", 2) . " Pesos</td></tr>";
}
}
if ($ban != 1) {
echo '<tr><th nowrap="nowrap">' . ($diff_payment < 0 ? $langs->trans("CustomerRet") : $langs->trans("CustomerDeb")) . '</th><td nowrap="nowrap">' . price(abs($diff_payment), "", "", "", "", 2) . " Pesos</td></tr>";
}
?>
</table>
<div class="note">
<p>
<?php
print 'Nota: ' . $object->note;
print $conf->global->POS_PREDEF_MSG;
?>
示例13: import2Dolibarr
//.........这里部分代码省略.........
continue;
}
if ($doliprod->fetch('', $ligne[0]) < 0) {
$this->process_msg .= $langs->trans("ErrProdNoExist", $ligne[0], $doliprod->error) . "\n";
} else {
$pid = $doliprod->id;
$doliprod->ref = $ligne[0];
if (!empty($ligne[1])) {
$doliprod->libelle = $ligne[1];
}
if (!empty($ligne[2])) {
$doliprod->status = $ligne[2];
}
$doliprod->status_buy = 1;
if (!empty($ligne[3])) {
$doliprod->description = $ligne[3];
}
if (!empty($ligne[4])) {
$doliprod->price = $ligne[4];
}
if (!empty($ligne[5])) {
$doliprod->tva_tx = $ligne[5];
}
if (!empty($ligne[6])) {
$doliprod->weight = $ligne[6];
}
if (!empty($ligne[7])) {
$doliprod->volume = $ligne[7];
}
if (!empty($ligne[9])) {
$doliprod->barcode = $ligne[9];
}
if (!empty($ligne[9])) {
$doliprod->barcode_type = dol_getIdFromCode($this->db, $ligne[10], 'c_barcode_type', 'libelle', 'rowid');
}
if (!empty($ligne[10])) {
$doliprod->type = $ligne[11];
}
$doliprod->price_base_type = 'HT';
$this->db->begin;
switch ($typeimport) {
case 'C':
if ($pid > 0) {
if ($doliprod->update($pid, $this->user) < 0) {
$this->process_msg .= $langs->trans("ErrProductUpdate", $ligne[0], $doliprod->error) . "\n";
$error++;
}
if ($doliprod->updatePrice($doliprod->price, $doliprod->price_base_type, $this->user) < 0) {
$this->process_msg .= $langs->trans("ErrProductUpdate", $ligne[0], $doliprod->error) . "\n";
$error++;
}
} else {
if ($doliprod->create($this->user) < 0) {
$this->process_msg .= $langs->trans("ErrProductCreate", $ligne[0], $doliprod->error) . "\n";
$error++;
} else {
// image et code barre
if ($ligne[8]) {
$this->add_photo_web($conf->produit->dir_output, $ligne[8], $doliprod->id);
}
/*if ($ligne[9]) {
if ($doliprod->setValueFrom('fk_barcode_type', 2) < 0){
$this->process_msg .= $langs->trans("ErrProductCreate", $ligne[0], $doliprod->error)."\n"; // TODO paramétrer
$error++;
}
if ($doliprod->setValueFrom('barcode', $ligne[9]) < 0 ){
示例14: demande_prelevement
/**
* Create a withdrawal request for a standing order
*
* @param User $fuser User asking standing order
* @param float $amount Amount we request withdraw for
* @return int <0 if KO, >0 if OK
*/
function demande_prelevement($fuser, $amount = 0)
{
global $langs;
$error = 0;
dol_syslog(get_class($this) . "::demande_prelevement", LOG_DEBUG);
if ($this->statut > self::STATUS_DRAFT && $this->paye == 0) {
require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
$bac = new CompanyBankAccount($this->db);
$bac->fetch(0, $this->socid);
$sql = 'SELECT count(*)';
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'prelevement_facture_demande';
$sql .= ' WHERE fk_facture = ' . $this->id;
$sql .= ' AND traite = 0';
dol_syslog(get_class($this) . "::demande_prelevement", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$row = $this->db->fetch_row($resql);
if ($row[0] == 0) {
$now = dol_now();
$totalpaye = $this->getSommePaiement();
$totalcreditnotes = $this->getSumCreditNotesUsed();
$totaldeposits = $this->getSumDepositsUsed();
//print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits;
// We can also use bcadd to avoid pb with floating points
// For example print 239.2 - 229.3 - 9.9; does not return 0.
//$resteapayer=bcadd($this->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
//$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
if (empty($amount)) {
$amount = price2num($this->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
}
if (is_numeric($amount) && $amount != 0) {
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . 'prelevement_facture_demande';
$sql .= ' (fk_facture, amount, date_demande, fk_user_demande, code_banque, code_guichet, number, cle_rib)';
$sql .= ' VALUES (' . $this->id;
$sql .= ",'" . price2num($amount) . "'";
$sql .= ",'" . $this->db->idate($now) . "'";
$sql .= "," . $fuser->id;
$sql .= ",'" . $bac->code_banque . "'";
$sql .= ",'" . $bac->code_guichet . "'";
$sql .= ",'" . $bac->number . "'";
$sql .= ",'" . $bac->cle_rib . "')";
dol_syslog(get_class($this) . "::demande_prelevement", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$this->error = $this->db->lasterror();
dol_syslog(get_class($this) . '::demandeprelevement Erreur');
$error++;
}
} else {
$this->error = 'WithdrawRequestErrorNilAmount';
dol_syslog(get_class($this) . '::demandeprelevement WithdrawRequestErrorNilAmount');
$error++;
}
if (!$error) {
// Force payment mode of invoice to withdraw
$payment_mode_id = dol_getIdFromCode($this->db, 'PRE', 'c_paiement');
if ($payment_mode_id > 0) {
$result = $this->setPaymentMethods($payment_mode_id);
}
}
if ($error) {
return -1;
}
return 1;
} else {
$this->error = "A request already exists";
dol_syslog(get_class($this) . '::demandeprelevement Impossible de creer une demande, demande deja en cours');
return 0;
}
} else {
$this->error = $this->db->error();
dol_syslog(get_class($this) . '::demandeprelevement Erreur -2');
return -2;
}
} else {
$this->error = "Status of invoice does not allow this";
dol_syslog(get_class($this) . "::demandeprelevement " . $this->error . " {$this->statut}, {$this->paye}, {$this->mode_reglement_id}");
return -3;
}
}
示例15: print_projecttasks_array
//.........这里部分代码省略.........
}
}
print_liste_field_titre($langs->trans("Status"), "", "", "", "", 'align="right"', $sortfield, $sortorder);
print "</tr>\n";
while ($i < $num) {
$objp = $db->fetch_object($resql);
$projectstatic->id = $objp->projectid;
$projectstatic->user_author_id = $objp->fk_user_creat;
$projectstatic->public = $objp->public;
// Check is user has read permission on project
$userAccess = $projectstatic->restrictedProjectArea($user);
if ($userAccess >= 0) {
$var = !$var;
print "<tr " . $bc[$var] . ">";
print '<td>';
$projectstatic->ref = $objp->ref;
print $projectstatic->getNomUrl(1);
if (!in_array('projectlabel', $hiddenfields)) {
print ' - ' . dol_trunc($objp->title, 24);
}
print '</td>';
print '<td>';
if ($objp->fk_soc > 0) {
$thirdpartystatic->id = $objp->fk_soc;
$thirdpartystatic->ref = $objp->socname;
$thirdpartystatic->name = $objp->socname;
print $thirdpartystatic->getNomUrl(1);
}
print '</td>';
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
print '<td align="right">';
if ($objp->opp_amount) {
print price($objp->opp_amount, 0, '', 1, -1, -1, $conf->currency);
}
print '</td>';
print '<td align="right">';
$code = dol_getIdFromCode($db, $objp->opp_status, 'c_lead_status', 'rowid', 'code');
if ($code) {
print $langs->trans("OppStatus" . $code);
}
print '</td>';
}
$projectstatic->statut = $objp->status;
if (empty($conf->global->PROJECT_HIDE_TASKS)) {
print '<td align="right">' . $objp->nb . '</td>';
$plannedworkload = $objp->planned_workload;
$total_plannedworkload += $plannedworkload;
if (!in_array('plannedworkload', $hiddenfields)) {
print '<td align="right">' . ($plannedworkload ? convertSecondToTime($plannedworkload) : '') . '</td>';
}
if (!in_array('declaredprogress', $hiddenfields)) {
$declaredprogressworkload = $objp->declared_progess_workload;
$total_declaredprogressworkload += $declaredprogressworkload;
print '<td align="right">';
//print $objp->planned_workload.'-'.$objp->declared_progess_workload."<br>";
print $plannedworkload ? round(100 * $declaredprogressworkload / $plannedworkload, 0) . '%' : '';
print '</td>';
}
}
print '<td align="right">' . $projectstatic->getLibStatut(3) . '</td>';
print "</tr>\n";
$total_task = $total_task + $objp->nb;
$total_opp_amount = $total_opp_amount + $objp->opp_amount;
$ponderated_opp_amount = $ponderated_opp_amount + price2num($listofoppstatus[$objp->opp_status] * $objp->opp_amount / 100);
}
$i++;
}
print '<tr class="liste_total">';
print '<td colspan="2">' . $langs->trans("Total") . "</td>";
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
print '<td class="liste_total" align="right">' . price($total_opp_amount, 0, '', 1, -1, -1, $conf->currency) . '</td>';
print '<td class="liste_total" align="right">' . $form->textwithpicto(price($ponderated_opp_amount, 0, '', 1, -1, -1, $conf->currency), $langs->trans("OpportunityPonderatedAmountDesc"), 1) . '</td>';
}
if (empty($conf->global->PROJECT_HIDE_TASKS)) {
print '<td class="liste_total" align="right">' . $total_task . '</td>';
if (!in_array('plannedworkload', $hiddenfields)) {
print '<td class="liste_total" align="right">' . ($total_plannedworkload ? convertSecondToTime($total_plannedworkload) : '') . '</td>';
}
if (!in_array('declaredprogress', $hiddenfields)) {
print '<td class="liste_total" align="right">' . ($total_plannedworkload ? round(100 * $total_declaredprogressworkload / $total_plannedworkload, 0) . '%' : '') . '</td>';
}
}
print '<td class="liste_total"></td>';
print '</tr>';
$db->free($resql);
} else {
dol_print_error($db);
}
print "</table>";
if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE)) {
//Add the year filter input
print '<form method="get" action="' . $_SERVER["PHP_SELF"] . '">';
print '<table width="100%">';
print '<tr>';
print '<td>' . $langs->trans("Year") . '</td>';
print '<td style="text-align:right"><input type="text" size="4" class="flat" name="project_year_filter" value="' . $project_year_filter . '"/>';
print "</tr>\n";
print '</table></form>';
}
}