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


PHP convertToDollar函数代码示例

本文整理汇总了PHP中convertToDollar函数的典型用法代码示例。如果您正苦于以下问题:PHP convertToDollar函数的具体用法?PHP convertToDollar怎么用?PHP convertToDollar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: foreach

    $focus->mode = $_REQUEST['mode'];
}
//$focus->retrieve($_REQUEST['record']);
foreach ($focus->column_fields as $fieldname => $val) {
    if (isset($_REQUEST[$fieldname])) {
        if (is_array($_REQUEST[$fieldname])) {
            $value = $_REQUEST[$fieldname];
        } else {
            $value = trim($_REQUEST[$fieldname]);
        }
        $log->info("the value is " . $value);
        $focus->column_fields[$fieldname] = $value;
    }
}
if (isset($_REQUEST['annualrevenue'])) {
    $value = convertToDollar($_REQUEST['annualrevenue'], $rate);
    $focus->column_fields['annualrevenue'] = $value;
}
if ($_REQUEST['assigntype'] == 'U') {
    $focus->column_fields['assigned_user_id'] = $_REQUEST['assigned_user_id'];
} elseif ($_REQUEST['assigntype'] == 'T') {
    $focus->column_fields['assigned_user_id'] = $_REQUEST['assigned_group_id'];
}
$focus->save("Leads");
$return_id = $focus->id;
$log->info("the return id is " . $return_id);
$parenttab = getParentTab();
if (isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "") {
    $return_module = vtlib_purify($_REQUEST['return_module']);
} else {
    $return_module = "Leads";
开发者ID:hardikk,项目名称:HNH,代码行数:31,代码来源:Save.php

示例2: number_format

            if ($sublevel == LENDER_GROUP_LEVEL) {
                $lusername = $lname;
            }
            $data = $database->getLenderDetails($leid);
            $hide_karma = $data['hide_karma'];
            //=0 means show karma score
            if ($hide_karma != 1) {
                $karma_score = "(" . number_format($database->getKarmaScore($leid)) . ")";
                $karma_tooltip = $lang['profile']['karma_tooltip'];
            } else {
                $karma_score = "";
            }
            $kamount = $rows['bidamount'];
            $bidint = $rows['bidint'];
            $lendprurl = getUserProfileUrl($leid);
            $lamt = convertToDollar($brw2['AmountGot'], $CurrencyRate);
            $percentFinanced = $bidamount * 100 / $lamt;
            echo "<tr>";
            echo "<td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<a href='{$lendprurl}'>{$lusername}</a> <br/><a style='cursor:pointer' class='tt'>{$karma_score}<span class='tooltip'><span class='top'></span><span class='middle'>{$karma_tooltip}</span><span class='bottom'></span></span></a>\n\t\t\t\t\t\t\t\t\t\t\t\t</td>";
            echo "<td>" . number_format($bidamount, 2, ".", ",") . "</td>";
            echo "<td>" . number_format($bidint, 2, ".", ",") . " %</td>";
            echo "</tr>";
        }
        ?>
								</tbody>
							</table>
						</div>
					
				<?php 
    }
}
开发者ID:mickdane,项目名称:zidisha,代码行数:31,代码来源:loanstatn.php

示例3: convertToDollar

    $focus->column_fields['expectedrevenue'] = $value;
}
if (isset($_REQUEST['budgetcost'])) {
    $value = convertToDollar($_REQUEST['budgetcost'], $rate);
    $focus->column_fields['budgetcost'] = $value;
}
if (isset($_REQUEST['actualcost'])) {
    $value = convertToDollar($_REQUEST['actualcost'], $rate);
    $focus->column_fields['actualcost'] = $value;
}
if (isset($_REQUEST['actualroi'])) {
    $value = convertToDollar($_REQUEST['actualroi'], $rate);
    $focus->column_fields['actualroi'] = $value;
}
if (isset($_REQUEST['expectedroi'])) {
    $value = convertToDollar($_REQUEST['expectedroi'], $rate);
    $focus->column_fields['expectedroi'] = $value;
}
if ($_REQUEST['assigntype'] == 'U') {
    $focus->column_fields['assigned_user_id'] = $_REQUEST['assigned_user_id'];
} elseif ($_REQUEST['assigntype'] == 'T') {
    $focus->column_fields['assigned_user_id'] = $_REQUEST['assigned_group_id'];
}
$focus->save("Campaigns");
$return_id = $focus->id;
$parenttab = getParentTab();
if (isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "") {
    $return_module = vtlib_purify($_REQUEST['return_module']);
} else {
    $return_module = "Campaigns";
}
开发者ID:hardikk,项目名称:HNH,代码行数:31,代码来源:Save.php

示例4: number_format

     $params['commentscredit'] = $tmpcurr . ' ' . number_format($commentcreditdetail['loanamt_limit'], 0, ".", ",");
     $params['commentcharlimit'] = $commentcreditdetail['character_limit'];
     $params['commentposted'] = $creditCurrent['commentposted'];
     $params['MinRepayRate'] = $database->getAdminSetting('MinRepayRate');
     $params['brwr_RepayRate'] = number_format($brwr_repayrate);
     $params['newmembercrdt_link'] = 'index.php?p=97';
     $params['invite_credit'] = $tmpcurr . ' ' . number_format($invitecredit);
     $params['vm_credit'] = $tmpcurr . ' ' . number_format($vmcredit);
 }
 $firstloan = $database->getBorrowerFirstLoan($userid);
 $disbdate = $database->getLoanDisburseDate($currentloan);
 $currenttime = time();
 $months = $database->IntervalMonths($disbdate, $currenttime);
 $loanData = $database->getLoanApplic($currentloan);
 $currentloanamt = $loanData['AmountGot'];
 $currentloanamt_usd = convertToDollar($currentloanamt, $rate);
 if ($currentloanamt_usd <= 200) {
     $timethrshld = $database->getAdminSetting('TimeThrshld');
 } elseif ($currentloanamt_usd <= 1000) {
     $timethrshld = $database->getAdminSetting('TimeThrshldMid1');
 } elseif ($currentloanamt_usd <= 3000) {
     $timethrshld = $database->getAdminSetting('TimeThrshldMid2');
 } elseif ($currentloanamt_usd > 3000) {
     $timethrshld = $database->getAdminSetting('TimeThrshld_above');
 }
 $params['TimeThrshld'] = $timethrshld;
 if (empty($firstloan) || $firstloan == 0) {
     $note = $session->formMessage($lang['current_credit']['first_loan'], $params);
 } elseif (empty($currentloan) && $islastrepaid) {
     $ontime = $database->isRepaidOntime($userid, $islastrepaid);
     if ($ontime != 1) {
开发者ID:narvee,项目名称:nripl.org,代码行数:31,代码来源:current_credit.php

示例5: convertToDollar

                                }
                                $divid = "replybox" . $i;
                                if ($commns['feedback'] == 3) {
                                    $feedbackText = "Neutral";
                                }
                                if ($commns['feedback'] == 4) {
                                    $feedbackText = "Negative";
                                } else {
                                    $feedbackText = "Positive";
                                }
                                /* Changes for zidisha loan feedback by chetan  */
                                if ($commns['loneid']) {
                                    $lendername = "Zidisha Loan";
                                    $loanDetail = $database->getLoanDetails($commns['loneid']);
                                    $amt = $loanDetail['AmountGot'];
                                    $amt_us = convertToDollar($amt, $rate);
                                    $date_disb = $loanDetail['AcceptDate'];
                                    if ($commns['ontime'] == 0) {
                                        $ontime = 'No';
                                    } else {
                                        $ontime = 'Yes';
                                    }
                                    $fully_repd = 'Yes';
                                    $name = $database->getUserNameById($sendid);
                                }
                                ?>
			<script type="text/javascript">
			$(document).ready(function() {		
				$('#partner_comment_desc<?php 
                                echo $i;
                                ?>
开发者ID:mickdane,项目名称:zidisha,代码行数:31,代码来源:profiles.php

示例6: loanReport

 function loanReport($brid)
 {
     global $db;
     $time = time();
     if (!empty($brid)) {
         $report = array('feedback' => '', 'Totalfeedback' => '');
         $result1 = $this->getPartnerComment($brid);
         $activation_comment = false;
         //$this->getActivationComment($brid);
         $lamount = 0;
         $countt = 0;
         $CPaid = 0;
         /*count for no of loan paid, given by partner   */
         $f = 0;
         $CPaidLate = 0;
         $PaidLate = 0;
         $PaidLate_us = 0;
         $CPaidOntime = 0;
         $PaidOntime = 0;
         $PaidOntime_us = 0;
         $defltdAmt = 0;
         $defltdAmt_us = 0;
         $rate = $this->getCurrentRate($brid);
         if ($result1) {
             $ldate = null;
             foreach ($result1 as $profile1) {
                 if ($profile1['loneid'] == 0) {
                     $ldate = $this->getborrowerActivatedDate($brid);
                     $lamount += $profile1['amount'];
                     $lpaid = $profile1['lpaid'];
                     if ($lpaid == 1) {
                         $CPaid += 1;
                     }
                     $ontime = $profile1['ontime'];
                     if ($profile1['rate'] != null && $profile1['rate'] != "" && $profile1['rate'] != 0) {
                         $rate = $profile1['rate'];
                     }
                     if ($ontime == 1) {
                         $CPaidOntime += 1;
                         $PaidOntime = $PaidOntime + $profile1['amount'];
                         $PaidOntime_us = $PaidOntime_us + convertToDollar($profile1['amount'], $rate);
                     } else {
                         $CPaidLate += 1;
                         $PaidLate = $PaidLate + $profile1['amount'];
                         $PaidLate_us = $PaidLate_us + convertToDollar($profile1['amount'], $rate);
                     }
                     $countt++;
                 }
                 $Pfeedback = $profile1['feedback'];
                 if ($Pfeedback == 2) {
                     $f += 1;
                 }
             }
             $count = count($result1);
             if (false && !$activation_comment) {
                 $f = $f - 1;
                 $count = count($result1) - 1;
                 if ($f == 0) {
                     $report['feedback'] = '';
                 } else {
                     $f = $f * 100 / $count;
                     $report['feedback'] = $f;
                 }
             } else {
                 $f = $f * 100 / $count;
                 $report['feedback'] = $f;
             }
             $partid = $profile1['partid'];
             $report['sincedate'] = $ldate;
             $report['Totalfeedback'] = count($result1);
         }
         $sql = "SELECT Amount, AcceptDate FROM ! WHERE active=?  AND borrowerid = ? AND adminDelete = ?";
         $data = $db->getAll($sql, array('loanapplic', LOAN_DEFAULTED, $brid, 0));
         if (count($data)) {
             for ($i = 0; $i < count($data); $i++) {
                 $defltdAmt += $data[$i]['Amount'];
                 $rate = $this->getExRateById($data[$i]['AcceptDate'], $brid);
                 $defltdAmt_us += convertToDollar($data[$i]['Amount'], $rate);
             }
             $report['Deflted'] = $i;
             $report['AmtDeflted'] = $defltdAmt;
             $report['AmtDeflted_us'] = $defltdAmt_us;
         }
         $sql = "SELECT loanid, AmountGot, period, ActiveDate, RepaidDate,AcceptDate FROM ! WHERE (active =? OR active =?) AND borrowerid = ? AND adminDelete = ?";
         $data = $db->getAll($sql, array('loanapplic', LOAN_REPAID, LOAN_ACTIVE, $brid, 0));
         foreach ($data as $row) {
             $period = $row['period'];
             $loanDate = $this->getMaxLoanDate($brid, $row['loanid']);
             $loneFundDate = $row['ActiveDate'];
             $expectedPayDate = $loanDate['duedateMax'];
             $lonePayDate = $loanDate['paiddateMax'];
             $rate = $this->getExRateById($row['AcceptDate'], $brid);
             if (empty($lonePayDate) && $expectedPayDate < $time) {
                 //late
                 $PaidLate += $row['AmountGot'];
                 $PaidLate_us += convertToDollar($row['AmountGot'], $rate);
                 $CPaidLate += 1;
             } else {
                 if (!empty($lonePayDate) && $expectedPayDate < $lonePayDate) {
                     //late
//.........这里部分代码省略.........
开发者ID:narvee,项目名称:nripl.org,代码行数:101,代码来源:database.php

示例7: getConvertedPrice

/**	Function used to retrieve the rate converted into dollar tobe saved into database
 *	The function accepts the price in the current currency
 *	return integer $conv_price  - 
 */
function getConvertedPrice($price)
{
    global $current_user;
    $currencyid = fetchCurrency($current_user->id);
    $rate_symbol = getCurrencySymbolandCRate($currencyid);
    $conv_price = convertToDollar($price, $rate_symbol['rate']);
    return $conv_price;
}
开发者ID:p6,项目名称:VF,代码行数:12,代码来源:CommonUtils.php

示例8: getDBInsertedValue

 /**
  * Returns the Currency value without formatting for DB Operations
  * @global Users $current_user
  * @param Users $user
  * @param Boolean $skipConversion
  * @return Number
  */
 public function getDBInsertedValue($user = null, $skipConversion = false)
 {
     global $current_user;
     if (empty($user)) {
         $user = $current_user;
     }
     $this->initialize($user);
     $value = $this->value;
     $currencySeparator = $this->currencySeparator;
     $decimalSeparator = $this->decimalSeparator;
     if (empty($currencySeparator)) {
         $currencySeparator = ' ';
     }
     if (empty($decimalSeparator)) {
         $decimalSeparator = ' ';
     }
     $value = str_replace("{$currencySeparator}", "", $value);
     $value = str_replace("{$decimalSeparator}", ".", $value);
     if ($skipConversion == false) {
         $value = convertToDollar($value, $this->conversionRate);
     }
     $value = round($value, $this->numberOfDecimal);
     return $value;
 }
开发者ID:sacredwebsite,项目名称:vtigercrm,代码行数:31,代码来源:CurrencyField.php

示例9: save_module

 function save_module($module)
 {
     global $current_user, $log, $adb;
     $cypid = $this->id;
     $data = $this->column_fields;
     // Entity has been saved, take next action
     $currencyid = fetchCurrency($current_user->id);
     $rate_symbol = getCurrencySymbolandCRate($currencyid);
     $rate = $rate_symbol['rate'];
     $value = 0;
     if (isset($data['amount']) and isset($data['cost'])) {
         $value = convertToDollar($data['amount'] - $data['cost'], $rate);
     }
     $adb->query("update vtiger_cobropago set benefit='{$value}' where cobropagoid=" . $cypid);
     $relatedId = $this->column_fields['related_id'];
     if (!empty($relatedId) and self::invoice_control_installed()) {
         Invoice::updateAmountDue($relatedId);
     }
     // Calculate related module balance
     $this->calculateRelatedTotals($this->column_fields['parent_id']);
 }
开发者ID:jaimeaga84,项目名称:corebos,代码行数:21,代码来源:CobroPago.php

示例10: getCurrentCreditLimit

 function getCurrentCreditLimit($userid, $addCreditearned)
 {
     global $database;
     $firstloan = $database->getBorrowerFirstLoan($userid);
     $loanstatus = $database->getLoanStatus($userid);
     $rate = $database->getCurrentRate($userid);
     $invitecredit = $database->getInviteCredit($userid);
     if ($loanstatus == LOAN_ACTIVE || $loanstatus == LOAN_FUNDED || $loanstatus == LOAN_OPEN) {
         //case where borrower has an active loan or fundraising application - we calculate credit limit based on current loan amount
         $loanid = $database->getCurrentLoanid($userid);
         $ontime = 1;
         //assume current loan will be repaid on time for purpose of displaying future credit limits
     } else {
         //case where borrower has repaid one or more loans and has not yet posted an application for a new one - we calculate credit limit based on most recently repaid loan amount
         $loanid = $database->getLastRepaidloanId($userid);
         $ontime = $database->isRepaidOntime($userid, $loanid);
     }
     $loanData = $database->getLoanApplic($loanid);
     $currentloanamt = $loanData['AmountGot'];
     if ($firstloan == 0) {
         //case where borrower has not yet received first loan disbursement - credit limit should equal admin 1st loan size plus invited borrower credit if applicable
         $val = $database->getAdminSetting('firstLoanValue');
         $invitedstatus = $database->getInvitee($userid);
         $text_length = $database->getTextResponseLength($userid);
         if (!empty($invitedstatus)) {
             $bonuscredit = 100;
             //adds bonus for new members who were invited by eligible existing members
         } elseif (!empty($text_length)) {
             if ($text_length >= 40 && $text_length <= 60) {
                 $bonuscredit = 100;
                 //adds bonus of for new members who entered optimal length of text response to 'How did you hear about Zidisha' optional question in application
             } else {
                 $bonuscredit = 0;
             }
         }
         $totalval = $val + $bonuscredit;
         $currentlimit = ceil(convertToNative($totalval, $rate));
         return $currentlimit;
     } elseif ($ontime != 1) {
         //case where last loan was repaid late - credit limit should equal last loan repaid on time or admin first loan setting, if no loan was ever repaid on time
         $prevamount = $database->getPreviousLoanAmount($userid, $loanid);
         if (!empty($prevamount) && $prevamount > 10) {
             $currentlimit = $prevamount;
         } else {
             $val = $database->getAdminSetting('firstLoanValue');
             $val_local = convertToNative($val, $rate);
             if ($addCreditearned == false) {
                 $currentlimit = $val_local;
             } else {
                 $currentlimit = ceil($val_local + $invitecredit);
             }
         }
         return $currentlimit;
     } else {
         //case where last loan was repaid on time, we next check whether monthly installment repayment rate meets threshold
         $repayrate = $this->RepaymentRate($userid);
         $minrepayrate = $database->getAdminSetting('MinRepayRate');
         if ($repayrate < $minrepayrate) {
             //case where last loan repaid on time but monthly installment repayment rate is below admin threshold - loan size stays same
             if ($addCreditearned == false) {
                 $currentlimit = ceil($currentloanamt);
             } else {
                 $currentlimit = ceil($currentloanamt + $invitecredit);
             }
         } else {
             //case where last loan repaid on time and overall repayment is above admin threshold - we next check whether the last loan was held long enough to qualify for credit limit increase, with the amount of time loans need to be held and size of increase both dependent on previous loan amount
             $disbdate = $database->getLoanDisburseDate($loanid);
             $currenttime = time();
             $months = $database->IntervalMonths($disbdate, $currenttime);
             $currentloanamt_usd = convertToDollar($currentloanamt, $rate);
             if ($currentloanamt_usd <= 200) {
                 $timethrshld = $database->getAdminSetting('TimeThrshld');
                 $percentincrease = $database->getAdminSetting('secondLoanPercentage');
             } elseif ($currentloanamt_usd <= 1000) {
                 $timethrshld = $database->getAdminSetting('TimeThrshldMid1');
                 $percentincrease = $database->getAdminSetting('nextLoanPercentage');
             } elseif ($currentloanamt_usd <= 3000) {
                 $timethrshld = $database->getAdminSetting('TimeThrshldMid2');
                 $percentincrease = $database->getAdminSetting('nextLoanPercentage');
             } elseif ($currentloanamt_usd > 3000) {
                 $timethrshld = $this->getAdminSetting('TimeThrshld_above');
                 $percentincrease = $database->getAdminSetting('nextLoanPercentage');
             }
             if ($months < $timethrshld) {
                 //if the loan has not been held long enough then borrower does not yet qualify for credit limit increase
                 if (!$addCreditearned) {
                     $currentlimit = ceil($currentloanamt);
                 } else {
                     $currentlimit = ceil($currentloanamt + $invitecredit);
                 }
             } else {
                 //case where last loan was repaid on time, overall repayment rate is above threshold and loan held for long enough to qualify for credit limit increase
                 $lastinst_amt = $database->getLastInstallmentAmt($userid, $loanid);
                 if ($lastinst_amt > $currentloanamt * 0.1 && convertToDollar($lastinst_amt, $rate) > 100) {
                     //case where more than 30% and $100 of last loan was paid in the last installment
                     if (!$addCreditearned) {
                         $currentlimit = ceil($currentloanamt);
                     } else {
                         $currentlimit = ceil($currentloanamt + $invitecredit);
                     }
//.........这里部分代码省略.........
开发者ID:xavier-s-a,项目名称:zidisha,代码行数:101,代码来源:session.php

示例11: insertIntoEntityTable


//.........这里部分代码省略.........
                     //the documents will stored in default folder
                 } else {
                     $fldvalue = $this->column_fields[$fieldname];
                 }
             } elseif ($uitype == 28) {
                 if ($this->column_fields[$fieldname] == null) {
                     $fileQuery = $adb->pquery("SELECT filename from vtiger_notes WHERE notesid = ?", array($this->id));
                     $fldvalue = null;
                     if (isset($fileQuery)) {
                         $rowCount = $adb->num_rows($fileQuery);
                         if ($rowCount > 0) {
                             $fldvalue = $adb->query_result($fileQuery, 0, 'filename');
                         }
                     }
                 } else {
                     $fldvalue = $this->column_fields[$fieldname];
                 }
             } elseif ($uitype == 8) {
                 $this->column_fields[$fieldname] = rtrim($this->column_fields[$fieldname], ',');
                 $ids = explode(',', $this->column_fields[$fieldname]);
                 $json = new Zend_Json();
                 $fldvalue = $json->encode($ids);
             } elseif ($uitype == 12) {
                 $query = "SELECT email1 FROM vtiger_users WHERE id = ?";
                 $res = $adb->pquery($query, array($current_user->id));
                 $rows = $adb->num_rows($res);
                 if ($rows > 0) {
                     $fldvalue = $adb->query_result($res, 0, 'email1');
                 }
             } elseif ($uitype == 71 && $generatedtype == 2) {
                 // Convert currency to base currency value before saving for custom fields of type currency
                 $currency_id = $current_user->currency_id;
                 $curSymCrate = getCurrencySymbolandCRate($currency_id);
                 $fldvalue = convertToDollar($this->column_fields[$fieldname], $curSymCrate['rate']);
             } else {
                 $fldvalue = $this->column_fields[$fieldname];
             }
             if ($uitype != 33 && $uitype != 8) {
                 $fldvalue = from_html($fldvalue, $insertion_mode == 'edit' ? true : false);
             }
         } else {
             $fldvalue = '';
         }
         if ($fldvalue == '') {
             $fldvalue = $this->get_column_value($columname, $fldvalue, $fieldname, $uitype, $datatype);
         }
         if ($insertion_mode == 'edit') {
             if ($table_name != 'vtiger_ticketcomments' && $uitype != 4) {
                 array_push($update, $columname . "=?");
                 array_push($update_params, $fldvalue);
             }
         } else {
             array_push($column, $columname);
             array_push($value, $fldvalue);
         }
     }
     if ($insertion_mode == 'edit') {
         if ($_REQUEST['module'] == 'Potentials') {
             $dbquery = 'select sales_stage from vtiger_potential where potentialid = ?';
             $sales_stage = $adb->query_result($adb->pquery($dbquery, array($this->id)), 0, 'sales_stage');
             if ($sales_stage != $_REQUEST['sales_stage'] && $_REQUEST['sales_stage'] != '') {
                 $date_var = date('YmdHis');
                 $closingdate = $_REQUEST['ajxaction'] == 'DETAILVIEW' ? $this->column_fields['closingdate'] : getDBInsertDateValue($this->column_fields['closingdate']);
                 $sql = "insert into vtiger_potstagehistory values(?,?,?,?,?,?,?,?)";
                 $params = array('', $this->id, $this->column_fields['amount'], decode_html($sales_stage), $this->column_fields['probability'], 0, $adb->formatDate($closingdate, true), $adb->formatDate($date_var, true));
                 $adb->pquery($sql, $params);
开发者ID:vtiger-jp,项目名称:vtigercrm-5.1.x-ja,代码行数:67,代码来源:CRMEntity.php

示例12: Potentials

 ********************************************************************************/
require_once 'modules/Potentials/Potentials.php';
require_once 'include/logging.php';
require_once 'include/database/PearDatabase.php';
$local_log =& LoggerManager::getLogger('index');
$focus = new Potentials();
//added to fix 4600
$search = vtlib_purify($_REQUEST['search_url']);
global $current_user;
$currencyid = fetchCurrency($current_user->id);
$rate_symbol = getCurrencySymbolandCRate($currencyid);
$rate = $rate_symbol['rate'];
$curr_symbol = $rate_symbol['symbol'];
setObjectValuesFromRequest($focus);
if (isset($_REQUEST['amount'])) {
    $value = convertToDollar($_REQUEST['amount'], $rate);
    $focus->column_fields['amount'] = $value;
}
if ($_REQUEST['assigntype'] == 'U') {
    $focus->column_fields['assigned_user_id'] = $_REQUEST['assigned_user_id'];
} elseif ($_REQUEST['assigntype'] == 'T') {
    $focus->column_fields['assigned_user_id'] = $_REQUEST['assigned_group_id'];
}
$focus->save("Potentials");
$pot_id = $return_id = $focus->id;
$parenttab = getParentTab();
if (isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "") {
    $return_module = vtlib_purify($_REQUEST['return_module']);
} else {
    $return_module = "Potentials";
}
开发者ID:vtiger-jp,项目名称:vtigercrm-5.1.x-ja,代码行数:31,代码来源:Save.php

示例13: vtws_convertlead

function vtws_convertlead($leadId, $assignedTo, $accountName, $avoidPotential, $potential, $user)
{
    global $adb, $log;
    if (empty($assignedTo)) {
        $assignedTo = vtws_getWebserviceEntityId('Users', $user->id);
    }
    if ((bool) $avoidPotential !== true) {
        try {
            if (empty($potential)) {
                throw new WebServiceException(WebServiceErrorCode::$INVALID_POTENTIAL_FOR_CONVERT_LEAD, "Invalid lead information given for potential");
            }
        } catch (Zend_Json_Exception $e) {
            throw new WebServiceException(WebServiceErrorCode::$INVALID_POTENTIAL_FOR_CONVERT_LEAD, "Potentail information given is not in valid JSON format");
        }
    }
    $currencyInfo = getCurrencySymbolandCRate($user->currency_id);
    $rate = $currencyInfo['rate'];
    if ($potential['amount'] != '') {
        $potential['amount'] = convertToDollar($potential['amount'], $rate);
    }
    $leadObject = VtigerWebserviceObject::fromName($adb, 'Leads');
    $handlerPath = $leadObject->getHandlerPath();
    $handlerClass = $leadObject->getHandlerClass();
    require_once $handlerPath;
    $leadHandler = new $handlerClass($leadObject, $user, $adb, $log);
    $leadHandler->getMeta()->retrieveMeta();
    $leadInfo = vtws_retrieve($leadId, $user);
    $sql = "select converted from vtiger_leaddetails where converted = 1 and leadid=?";
    $leadIdComponents = vtws_getIdComponents($leadId);
    $result = $adb->pquery($sql, array($leadIdComponents[1]));
    if ($result === false) {
        throw new WebServiceException(WebServiceErrorCode::$DATABASEQUERYERROR, "Database error while performing required operation");
    }
    $rowCount = $adb->num_rows($result);
    if ($rowCount > 0) {
        throw new WebServiceException(WebServiceErrorCode::$LEAD_ALREADY_CONVERTED, "Lead is already converted");
    }
    $customFieldMapping = vtws_getConvertLeadFieldMapping();
    //check if accountName given in request is empty then default to lead company field.
    if (empty($accountName)) {
        $accountName = $leadInfo['company'];
    }
    $sql = "select vtiger_account.accountid from vtiger_account\n\t\tleft join vtiger_crmentity on vtiger_account.accountid = vtiger_crmentity.crmid\n\t\twhere vtiger_crmentity.deleted=0 and vtiger_account.accountname = ?";
    $result = $adb->pquery($sql, array($accountName));
    if ($result === false) {
        throw new WebServiceException(WebServiceErrorCode::$DATABASEQUERYERROR, "Database error while performing required operation");
    }
    $rowCount = $adb->num_rows($result);
    if ($rowCount != 0 && vtlib_isModuleActive('Accounts') === true) {
        $crmId = $adb->query_result($result, 0, "accountid");
        $status = vtws_getRelatedNotesAttachments($leadIdComponents[1], $crmId);
        if ($status === false) {
            throw new WebServiceException(WebServiceErrorCode::$LEAD_RELATED_UPDATE_FAILED, "Failed to move related Documents to the Account");
        }
        //Retrieve the lead related products and relate them with this new account
        $status = vtws_saveLeadRelatedProducts($leadIdComponents[1], $crmId, "Accounts");
        if ($status === false) {
            throw new WebServiceException(WebServiceErrorCode::$LEAD_RELATED_UPDATE_FAILED, "Failed to move related Products to the Account");
        }
        $status = vtws_saveLeadRelations($leadIdComponents[1], $crmId, "Accounts");
        if ($status === false) {
            throw new WebServiceException(WebServiceErrorCode::$LEAD_RELATED_UPDATE_FAILED, "Failed to move Records to the Account");
        }
    } else {
        //don't create account if no company name is given in input and lead doest not have
        // company field populated, DONE TO RESPECT B2C model.
        if (!empty($accountName)) {
            $accountObject = VtigerWebserviceObject::fromName($adb, 'Accounts');
            $handlerPath = $accountObject->getHandlerPath();
            $handlerClass = $accountObject->getHandlerClass();
            require_once $handlerPath;
            $accountHandler = new $handlerClass($accountObject, $user, $adb, $log);
            if ($accountHandler->getMeta()->hasWriteAccess()) {
                $account = array();
                if (!empty($leadInfo["annualrevenue"])) {
                    $account['annual_revenue'] = $leadInfo["annualrevenue"];
                }
                if (!empty($leadInfo["noofemployees"])) {
                    $account['employees'] = $leadInfo["noofemployees"];
                }
                $account['accountname'] = $accountName;
                $account['industry'] = $leadInfo["industry"];
                $account['phone'] = $leadInfo["phone"];
                $account['fax'] = $leadInfo["fax"];
                $account['rating'] = $leadInfo["rating"];
                $account['email1'] = $leadInfo["email"];
                $account['website'] = $leadInfo["website"];
                $account['bill_city'] = $leadInfo["city"];
                $account['bill_code'] = $leadInfo["code"];
                $account['bill_country'] = $leadInfo["country"];
                $account['bill_state'] = $leadInfo["state"];
                $account['bill_street'] = $leadInfo["lane"];
                $account['bill_pobox'] = $leadInfo["pobox"];
                $account['ship_city'] = $leadInfo["city"];
                $account['ship_code'] = $leadInfo["code"];
                $account['ship_country'] = $leadInfo["country"];
                $account['ship_state'] = $leadInfo["state"];
                $account['ship_street'] = $leadInfo["lane"];
                $account['ship_pobox'] = $leadInfo["pobox"];
                $account['assigned_user_id'] = $assignedTo;
//.........这里部分代码省略.........
开发者ID:latechdirect,项目名称:vtiger,代码行数:101,代码来源:ConvertLead.php

示例14: getCurrencySymbolandCRate

    $assigned_user_id = $_REQUEST["assigned_group_id"];
}
$accountname = $_REQUEST['account_name'];
$potential_amount = $_REQUEST['potential_amount'];
$potential_sales_stage = $_REQUEST['potential_sales_stage'];
global $log, $current_user;
require 'user_privileges/user_privileges_' . $current_user->id . '.php';
if ($assigned_to == "U") {
    $log->debug("id = {$id} \n assigned_user_id = {$assigned_user_id} \n createpotential = {$createpotential} \n close date = {$close_date} \n current user id = {$current_user_id} \n accountname = {$accountname} \n module = {$module}");
} else {
    $log->debug("id = {$id} \n assigned_user_id = {$assigned_group_id} \n createpotential = {$createpotential} \n close date = {$close_date} \n current user id = {$current_user_id} \n accountname = {$accountname} \n module = {$module}");
}
$rate_symbol = getCurrencySymbolandCRate($user_info['currency_id']);
$rate = $rate_symbol['rate'];
if ($potential_amount != '') {
    $potential_amount = convertToDollar($potential_amount, $rate);
}
//Retrieve info from all the vtiger_tables related to leads
$focus = new Leads();
$focus->retrieve_entity_info($id, "Leads");
//get all the lead related columns
$row = $focus->column_fields;
$date_entered = $adb->formatDate(date('Y-m-d H:i:s'), true);
$date_modified = $adb->formatDate(date('Y-m-d H:i:s'), true);
/** Function for getting the custom values from leads and saving to vtiger_account/contact/potential custom vtiger_fields.
 *  @param string $type - Field Type (eg: text, list)
 *  @param integer $type_id - Field Type ID 
*/
function getInsertValues($type, $type_id)
{
    global $id, $adb, $log;
开发者ID:vtiger-jp,项目名称:vtigercrm-5.1.x-ja,代码行数:31,代码来源:LeadConvertToEntities.php

示例15: getInviteCredit

 function getInviteCredit($userid)
 {
     global $session;
     $invitees = $this->getInvitedMember($userid);
     $creditearned = 0;
     foreach ($invitees as $invite) {
         $inviterepayrate = $session->RepaymentRate($invite['invitee_id']);
         $invite_lastloan = $this->getLastloan($invite['invitee_id']);
         if (empty($invite_lastloan)) {
             $inviterepayrate = 0;
         }
         $minrepayrate = $this->getAdminSetting('MinRepayRate');
         if ($inviterepayrate >= $minrepayrate) {
             $country = $this->getCountryCodeById($userid);
             $binvitecredit = $this->getcreditsettingbyCountry($country, 3);
             $creditearned += $binvitecredit['loanamt_limit'];
         }
     }
     $rate = $this->getCurrentRate($userid);
     $creditearned_usd = convertToDollar($creditearned, $rate);
     if ($creditearned_usd > 1000) {
         $creditearned_usd = 1000;
     }
     $creditearned = convertToNative($creditearned_usd, $rate);
     return $creditearned;
 }
开发者ID:mickdane,项目名称:zidisha,代码行数:26,代码来源:database.php


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