private function x2f($x0c, $x0e, $x94 = false) { global $x15d, $x15e, $x15f, $x160, $x161, $x162, $x163, $x164, $x165, $x166, $x167, $x168, $x169, $x16a, $x16b, $x16c, $x16d, $x16e, $x16f, $x170, $x171, $x172, $x173, $x174, $x175, $x176, $x177, $x178; if (!isset(self::$x22[$x0c])) { $this->x2e($x0c, $x0e); } if (!isset(self::$x22[$x0c])) { return array(); } $x13e = ""; if ($x94 !== false) { $x13e = "R_" . $x175($x94) . "_"; } self::$x21["\$" . $x13e . "SUBTOTAL\$"] = $this->x23($x0e->column_fields["hdnSubTotal"]); self::$x21["\$" . $x13e . "TOTAL\$"] = $this->x23($x0e->column_fields["hdnGrandTotal"]); $xf9 = $this->x21($x0c, $x0e); $xf9["currency_symbol"] = $x172("тя┐╜м", "€", $xf9["currency_symbol"]); $xf9["currency_symbol"] = $x172("┬┬г", "£", $xf9["currency_symbol"]); self::$x21["\$" . $x13e . "CURRENCYNAME\$"] = getTranslatedCurrencyString($xf9["currency_name"]); self::$x21["\$" . $x13e . "CURRENCYSYMBOL\$"] = $xf9["currency_symbol"]; self::$x21["\$" . $x13e . "CURRENCYCODE\$"] = $xf9["currency_code"]; self::$x21["\$" . $x13e . "ADJUSTMENT\$"] = $this->x23($x0e->column_fields["txtAdjustment"]); $x6f = $this->x18($x0c, $x0e); self::$x21["\$" . $x13e . "TOTALWITHOUTVAT\$"] = $x6f["TOTAL"]["TOTALWITHOUTVAT"]; self::$x21["\$" . $x13e . "VAT\$"] = $x6f["TOTAL"]["TAXTOTAL"]; self::$x21["\$" . $x13e . "VATPERCENT\$"] = $x6f["TOTAL"]["TAXTOTALPERCENT"]; self::$x21["\$" . $x13e . "TOTALWITHVAT\$"] = $x6f["TOTAL"]["TOTALWITHVAT"]; self::$x21["\$" . $x13e . "SHTAXAMOUNT\$"] = $x6f["TOTAL"]["SHTAXAMOUNT"]; self::$x21["\$" . $x13e . "SHTAXTOTAL\$"] = $x6f["TOTAL"]["SHTAXTOTAL"]; self::$x21["\$" . $x13e . "TOTALDISCOUNT\$"] = $x6f["TOTAL"]["FINALDISCOUNT"]; self::$x21["\$" . $x13e . "TOTALDISCOUNTPERCENT\$"] = $x6f["TOTAL"]["FINALDISCOUNTPERCENT"]; self::$x21["\$" . $x13e . "TOTALAFTERDISCOUNT\$"] = $x6f["TOTAL"]["TOTALAFTERDISCOUNT"]; $this->x15(); if ($x94 === false) { if ($x161($x6f["TOTAL"]["VATBLOCK"]) > 0) { $x14d = "<table border='1' style='border-collapse:collapse;' cellpadding='3'>"; $x14d .= "<tr>\r\n <td nowrap align='center'>" . vtranslate("Name") . "</td>\n\n <td nowrap align='center'>" . self::$x10["LBL_VATBLOCK_VAT_PERCENT"] . "</td>\r\n <td nowrap align='center'>" . self::$x10["LBL_VATBLOCK_SUM"] . " (" . $xf9["currency_symbol"] . ")" . "</td>\r\n <td nowrap align='center'>" . self::$x10["LBL_VATBLOCK_VAT_VALUE"] . " (" . $xf9["currency_symbol"] . ")" . "</td>\r\n </tr>"; foreach ($x6f["TOTAL"]["VATBLOCK"] as $x14e => $x14f) { if ($x14f["netto"] != 0) { $x14d .= "<tr>\n <td nowrap align='left' width='20%'>" . $x14f["label"] . "</td>\n\n \t\t\t\t<td nowrap align='right' width='25%'>" . $this->x23($x14f["value"]) . " %</td>\r\n <td nowrap align='right' width='30%'>" . $this->x23($x14f["netto"]) . "</td>\r\n <td nowrap align='right' width='25%'>" . $this->x23($x14f["vat"]) . "</td>\r\n </tr>"; } } $x14d .= "</table>"; } else { $x14d = ""; } self::$x21["\$" . "VATBLOCK\$"] = $x14d; $this->x15(); if ($x176(self::$x1c, "#VATBLOCK_START#") !== false && $x176(self::$x1c, "#VATBLOCK_END#") !== false) { $this->x29(); $x150 = array(); $x151 = $x163("#VATBLOCK_START#", self::$x1c); $x150[] = $x151[0]; for ($x79 = 1; $x79 < $x161($x151); $x79++) { $x152 = $x163("#VATBLOCK_END#", $x151[$x79]); foreach ($x152 as $x153) { $x150[] = $x153; } $x154 = $x79 * 2 - 1; $x155[$x154] = $x150[$x154]; $x150[$x154] = ''; } if ($x161($x6f["TOTAL"]["VATBLOCK"]) > 0) { foreach ($x6f["TOTAL"]["VATBLOCK"] as $x14e => $x14f) { foreach ($x155 as $x7f => $x80) { if ($x14f["netto"] != 0) { foreach ($x14f as $x156 => $x157) { if ($x16a($x157)) { $x157 = $this->x23($x157); } $x80 = $x172("\$" . "VATBLOCK_" . $x175($x156) . "\$", $x157, $x80); } $x150[$x7f] .= $x80; } } } } self::$x1c = $x167('', $x150); } } return $x6f; }
function content_5674dd1390175($_smarty_tpl) { ?> <!DOCTYPE html><html><head><title>Vtiger</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><link REL="SHORTCUT ICON" HREF="layouts/vlayout/skins/images/favicon.ico"><link rel="stylesheet" href="libraries/bootstrap/css/bootstrap.css" type="text/css" media="screen" /><link rel="stylesheet" href="resources/styles.css" type="text/css" media="screen" /><link rel="stylesheet" href="libraries/jquery/select2/select2.css" /><link rel="stylesheet" href="libraries/jquery/posabsolute-jQuery-Validation-Engine/css/validationEngine.jquery.css" /><script type="text/javascript" src="libraries/jquery/jquery.min.js"></script><script type="text/javascript" src="libraries/bootstrap/js/bootstrap-tooltip.js"></script><script type="text/javascript" src="libraries/jquery/select2/select2.min.js"></script><script type="text/javascript" src="libraries/jquery/posabsolute-jQuery-Validation-Engine/js/jquery.validationEngine.js" ></script><script type="text/javascript" src="libraries/jquery/posabsolute-jQuery-Validation-Engine/js/jquery.validationEngine-en.js" ></script><script type="text/javascript"> jQuery(function(){ jQuery('select').select2({blurOnChange:true}); jQuery('[rel="tooltip"]').tooltip(); jQuery('form').validationEngine({ prettySelect: true, usePrefix: 's2id_', autoPositionUpdate: true, promptPosition : "topLeft", showOneMessage: true }); jQuery('#currency_name_controls').mouseenter(function() { jQuery('#currency_name_tooltip').tooltip('show'); }); jQuery('#currency_name_controls').mouseleave(function() { jQuery('#currency_name_tooltip').tooltip('hide'); }); }); </script><style type="text/css"> body { background: #ffffff url('layouts/vlayout/skins/images/usersetupbg.png') no-repeat center top; background-size: 100%; font-size: 14px; } .modal-backdrop { opacity: 0.35; } .tooltip { z-index: 1055; } input, select, textarea { font-size: 14px; } </style></head><body><div class="container"><div class="modal-backdrop"></div><form class="form" method="POST" action="index.php?module=Users&action=UserSetupSave"><div class="modal" <?php if (false && $_smarty_tpl->tpl_vars['IS_FIRST_USER']->value) { ?> style="width: 700px;"<?php } ?> > <div class="modal-header"><h3><?php echo vtranslate('LBL_ALMOST_THERE', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </h3></div><div class="modal-body"><div class="row"><?php if (false && $_smarty_tpl->tpl_vars['IS_FIRST_USER']->value) { ?> <div class="span4"><label class="control-label"><strong><?php echo vtranslate('LBL_ABOUT_ME', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </strong> <span class="muted"><?php echo vtranslate('LBL_WE_PROMISE_TO_KEEP_THIS_PRIVATE', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </span></label><div class="controls"><input type="text" name="about[phone]" id="phone" placeholder="<?php echo vtranslate('LBL_PHONE', $_smarty_tpl->tpl_vars['MODULE']->value); ?> " rel="tooltip" title="<?php echo vtranslate('LBL_YOUR_CONTACT_NUMBER', $_smarty_tpl->tpl_vars['MODULE']->value); ?> " style="width:250px;"></div><div class="controls"><select name="about[country]" id="country" placeholder="<?php echo vtranslate('LBL_SELECT_COUNTRY', $_smarty_tpl->tpl_vars['MODULE']->value); ?> " rel="tooltip" title="<?php echo vtranslate('LBL_WHERE_ARE_YOU_FROM', $_smarty_tpl->tpl_vars['MODULE']->value); ?> " style="width:250px;"><option value=""></option><!-- to allow select2 pick placeholder --><option value="Prefer Not to Disclose">Prefer Not to Disclose</option><option value="United States">United States</option><option value="Afghanistan">Afghanistan</option><option value="Africa">Africa</option><option value="Albania">Albania</option><option value="Algeria">Algeria</option><option value="American Samoa">American Samoa</option><option value="Andorra">Andorra</option><option value="Angola">Angola</option><option value="Anguilla">Anguilla</option><option value="Antarctica">Antarctica</option><option value="Antigua & Barbuda">Antigua & Barbuda</option><option value="Antilles, Netherlands">Antilles, Netherlands</option><option value="Arabia, Saudi">Arabia, Saudi</option><option value="Argentina">Argentina</option><option value="Armenia">Armenia</option><option value="Aruba">Aruba</option><option value="Asia">Asia</option><option value="Australia">Australia</option><option value="Austria">Austria</option><option value="Azerbaijan">Azerbaijan</option><option value="Bahamas, The">Bahamas, The</option><option value="Bahrain">Bahrain</option><option value="Bangladesh">Bangladesh</option><option value="Barbados">Barbados</option><option value="Belarus">Belarus</option><option value="Belgium">Belgium</option><option value="Belize">Belize</option><option value="Benin">Benin</option><option value="Bermuda">Bermuda</option><option value="Bhutan">Bhutan</option><option value="Bolivia">Bolivia</option><option value="Bosnia and Herzegovina">Bosnia and Herzegovina</option><option value="Botswana">Botswana</option><option value="Bouvet Island">Bouvet Island</option><option value="Brazil">Brazil</option><option value="British Indian Ocean T.">British Indian Ocean T.</option><option value="British Virgin Islands">British Virgin Islands</option><option value="Brunei Darussalam">Brunei Darussalam</option><option value="Bulgaria">Bulgaria</option><option value="Burkina Faso">Burkina Faso</option><option value="Burundi">Burundi</option><option value="Cambodia">Cambodia</option><option value="Cameroon">Cameroon</option><option value="Canada">Canada</option><option value="Cape Verde">Cape Verde</option><option value="Caribbean, the">Caribbean, the</option><option value="Cayman Islands">Cayman Islands</option><option value="Central African Republic">Central African Republic</option><option value="Central America">Central America</option><option value="Chad">Chad</option><option value="Chile">Chile</option><option value="China">China</option><option value="Christmas Island">Christmas Island</option><option value="Cocos (Keeling) Islands">Cocos (Keeling) Islands</option><option value="Colombia">Colombia</option><option value="Comoros">Comoros</option><option value="Congo">Congo</option><option value="Congo, Dem. Rep. of the">Congo, Dem. Rep. of the</option><option value="Cook Islands">Cook Islands</option><option value="Costa Rica">Costa Rica</option><option value="Cote D'Ivoire">Cote D'Ivoire</option><option value="Croatia">Croatia</option><option value="Cuba">Cuba</option><option value="Cyprus">Cyprus</option><option value="Czech Republic">Czech Republic</option><option value="Denmark">Denmark</option><option value="Djibouti">Djibouti</option><option value="Dominica">Dominica</option><option value="Dominican Republic">Dominican Republic</option><option value="East Timor (Timor-Leste)">East Timor (Timor-Leste)</option><option value="Ecuador">Ecuador</option><option value="Egypt">Egypt</option><option value="El Salvador">El Salvador</option><option value="Equatorial Guinea">Equatorial Guinea</option><option value="Eritrea">Eritrea</option><option value="Estonia">Estonia</option><option value="Ethiopia">Ethiopia</option><option value="Europe">Europe</option><option value="European Union">European Union</option><option value="Falkland Islands (Malvinas)">Falkland Islands (Malvinas)</option><option value="Faroe Islands">Faroe Islands</option><option value="Fiji">Fiji</option><option value="Finland">Finland</option><option value="France">France</option><option value="French Guiana">French Guiana</option><option value="French Polynesia">French Polynesia</option><option value="French Southern Terr.">French Southern Terr.</option><option value="Gabon">Gabon</option><option value="Gambia, the">Gambia, the</option><option value="Georgia">Georgia</option><option value="Germany">Germany</option><option value="Ghana">Ghana</option><option value="Gibraltar">Gibraltar</option><option value="Greece">Greece</option><option value="Greenland">Greenland</option><option value="Grenada">Grenada</option><option value="Guadeloupe">Guadeloupe</option><option value="Guam">Guam</option><option value="Guatemala">Guatemala</option><option value="Guernsey and Alderney">Guernsey and Alderney</option><option value="Guiana, French">Guiana, French</option><option value="Guinea">Guinea</option><option value="Guinea-Bissau">Guinea-Bissau</option><option value="Guinea, Equatorial">Guinea, Equatorial</option><option value="Guyana">Guyana</option><option value="Haiti">Haiti</option><option value="Heard & McDonald Is.(AU)">Heard & McDonald Is.(AU)</option><option value="Holy See (Vatican)">Holy See (Vatican)</option><option value="Honduras">Honduras</option><option value="Hong Kong, (China)">Hong Kong, (China)</option><option value="Hungary">Hungary</option><option value="Iceland">Iceland</option><option value="India">India</option><option value="Indonesia">Indonesia</option><option value="Iran, Islamic Republic of">Iran, Islamic Republic of</option><option value="Iraq">Iraq</option><option value="Ireland">Ireland</option><option value="Israel">Israel</option><option value="Italy">Italy</option><option value="Ivory Coast (Cote d'Ivoire)">Ivory Coast (Cote d'Ivoire)</option><option value="Jamaica">Jamaica</option><option value="Japan">Japan</option><option value="Jersey">Jersey</option><option value="Jordan">Jordan</option><option value="Kazakhstan">Kazakhstan</option><option value="Kenya">Kenya</option><option value="Kiribati">Kiribati</option><option value="Korea Dem. People's Rep.">Korea Dem. People's Rep.</option><option value="Korea, (South) Republic of">Korea, (South) Republic of</option><option value="Kosovo">Kosovo</option><option value="Kuwait">Kuwait</option><option value="Kyrgyzstan">Kyrgyzstan</option><option value="Lao People's Democ. Rep.">Lao People's Democ. Rep.</option><option value="Latvia">Latvia</option><option value="Lebanon">Lebanon</option><option value="Lesotho">Lesotho</option><option value="Liberia">Liberia</option><option value="Libyan Arab Jamahiriya">Libyan Arab Jamahiriya</option><option value="Liechtenstein">Liechtenstein</option><option value="Lithuania">Lithuania</option><option value="Luxembourg">Luxembourg</option><option value="Macao, (China)">Macao, (China)</option><option value="Macedonia, TFYR">Macedonia, TFYR</option><option value="Madagascar">Madagascar</option><option value="Malawi">Malawi</option><option value="Malaysia">Malaysia</option><option value="Maldives">Maldives</option><option value="Mali">Mali</option><option value="Malta">Malta</option><option value="Man, Isle of">Man, Isle of</option><option value="Marshall Islands">Marshall Islands</option><option value="Martinique (FR)">Martinique (FR)</option><option value="Mauritania">Mauritania</option><option value="Mauritius">Mauritius</option><option value="Mayotte (FR)">Mayotte (FR)</option><option value="Mexico">Mexico</option><option value="Micronesia, Fed. States of">Micronesia, Fed. States of</option><option value="Middle East">Middle East</option><option value="Moldova, Republic of">Moldova, Republic of</option><option value="Monaco">Monaco</option><option value="Mongolia">Mongolia</option><option value="Montenegro">Montenegro</option><option value="Montserrat">Montserrat</option><option value="Morocco">Morocco</option><option value="Mozambique">Mozambique</option><option value="Myanmar (ex-Burma)">Myanmar (ex-Burma)</option><option value="Namibia">Namibia</option><option value="Nauru">Nauru</option><option value="Nepal">Nepal</option><option value="Netherlands">Netherlands</option><option value="Netherlands Antilles">Netherlands Antilles</option><option value="New Caledonia">New Caledonia</option><option value="New Zealand">New Zealand</option><option value="Nicaragua">Nicaragua</option><option value="Niger">Niger</option><option value="Nigeria">Nigeria</option><option value="Niue">Niue</option><option value="Norfolk Island">Norfolk Island</option><option value="North America">North America</option><option value="Northern Mariana Islands">Northern Mariana Islands</option><option value="Norway">Norway</option><option value="Oceania">Oceania</option><option value="Oman">Oman</option><option value="Pakistan">Pakistan</option><option value="Palau">Palau</option><option value="Palestinian Territory">Palestinian Territory</option><option value="Panama">Panama</option><option value="Papua New Guinea">Papua New Guinea</option><option value="Paraguay">Paraguay</option><option value="Peru">Peru</option><option value="Philippines">Philippines</option><option value="Pitcairn Island">Pitcairn Island</option><option value="Poland">Poland</option><option value="Portugal">Portugal</option><option value="Puerto Rico">Puerto Rico</option><option value="Qatar">Qatar</option><option value="Reunion (FR)">Reunion (FR)</option><option value="Romania">Romania</option><option value="Russia (Russian Fed.)">Russia (Russian Fed.)</option><option value="Rwanda">Rwanda</option><option value="Sahara, Western">Sahara, Western</option><option value="Saint Barthelemy (FR)">Saint Barthelemy (FR)</option><option value="Saint Helena (UK)">Saint Helena (UK)</option><option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option><option value="Saint Lucia">Saint Lucia</option><option value="Saint Martin (FR)">Saint Martin (FR)</option><option value="S Pierre & Miquelon(FR)">S Pierre & Miquelon(FR)</option><option value="S Vincent & Grenadines">S Vincent & Grenadines</option><option value="Samoa">Samoa</option><option value="San Marino">San Marino</option><option value="Sao Tome and Principe">Sao Tome and Principe</option><option value="Saudi Arabia">Saudi Arabia</option><option value="Senegal">Senegal</option><option value="Serbia">Serbia</option><option value="Seychelles">Seychelles</option><option value="Sierra Leone">Sierra Leone</option><option value="Singapore">Singapore</option><option value="Slovakia">Slovakia</option><option value="Slovenia">Slovenia</option><option value="Solomon Islands">Solomon Islands</option><option value="Somalia">Somalia</option><option value="South Africa">South Africa</option><option value="South America">South America</option><option value="S.George & S.Sandwich">S.George & S.Sandwich</option><option value="South Sudan">South Sudan</option><option value="Spain">Spain</option><option value="Sri Lanka (ex-Ceilan)">Sri Lanka (ex-Ceilan)</option><option value="Sudan">Sudan</option><option value="Suriname">Suriname</option><option value="Svalbard & Jan Mayen Is.">Svalbard & Jan Mayen Is.</option><option value="Swaziland">Swaziland</option><option value="Sweden">Sweden</option><option value="Switzerland">Switzerland</option><option value="Syrian Arab Republic">Syrian Arab Republic</option><option value="Taiwan">Taiwan</option><option value="Tajikistan">Tajikistan</option><option value="Tanzania, United Rep. of">Tanzania, United Rep. of</option><option value="Thailand">Thailand</option><option value="Timor-Leste (East Timor)">Timor-Leste (East Timor)</option><option value="Togo">Togo</option><option value="Tokelau">Tokelau</option><option value="Tonga">Tonga</option><option value="Trinidad & Tobago">Trinidad & Tobago</option><option value="Tunisia">Tunisia</option><option value="Turkey">Turkey</option><option value="Turkmenistan">Turkmenistan</option><option value="Turks and Caicos Is.">Turks and Caicos Is.</option><option value="Tuvalu">Tuvalu</option><option value="Uganda">Uganda</option><option value="Ukraine">Ukraine</option><option value="United Arab Emirates">United Arab Emirates</option><option value="United Kingdom">United Kingdom</option><option value="US Minor Outlying Isl.">US Minor Outlying Isl.</option><option value="Uruguay">Uruguay</option><option value="Uzbekistan">Uzbekistan</option><option value="Vanuatu">Vanuatu</option><option value="Vatican (Holy See)">Vatican (Holy See)</option><option value="Venezuela">Venezuela</option><option value="Viet Nam">Viet Nam</option><option value="Virgin Islands, British">Virgin Islands, British</option><option value="Virgin Islands, U.S.">Virgin Islands, U.S.</option><option value="Wallis and Futuna">Wallis and Futuna</option><option value="Western Sahara">Western Sahara</option><option value="Yemen">Yemen</option><option value="Zambia">Zambia</option><option value="Zimbabwe">Zimbabwe</option></select><div style="padding-top:10px;"></div></div><div class="controls"><select name="about[company_size]" id="company_size" placeholder="<?php echo vtranslate('LBL_COMPANY_SIZE', $_smarty_tpl->tpl_vars['MODULE']->value); ?> " style="width:250px;"><option value=""></option><!-- to allow select2 pick placeholder --><option value="Prefer Not to Disclose">Prefer Not to Disclose</option><option value="1">1</option><option value="2 - 3">2 - 3</option><option value="4 - 7">4 - 7</option><option value="8 - 15">8 - 15</option><option value="16 - 25">16 - 25</option><option value="26 - 50">26 - 50</option><option value="51 - 100">51 - 100</option><option value="101 - 250">101 - 250</option><option value="251 - 500">251 - 500</option><option value="501 +">501 +</option></select><div style="padding-top:10px;"></div></div><div class="controls"><select name="about[company_job]" id="company_job" placeholder="<?php echo vtranslate('LBL_JOB_TITLE', $_smarty_tpl->tpl_vars['MODULE']->value); ?> " style="width:250px;"><option value=""></option><!-- to allow select2 pick placeholder --><option value="Prefer Not to Disclose">Prefer Not to Disclose</option><option value="CEO/President">CEO/President</option><option value="Chief Officer">Chief Officer</option><option value="Vice President">Vice President</option><option value="Director">Director</option><option value="Manager">Manager</option><option value="Project Manager">Project Manager</option><option value="Specialist">Specialist</option><option value="Consultant">Consultant</option><option value="Employee">Employee</option><option value="Other">Other</option></select><div style="padding-top:10px;"></div></div><div class="controls"><select name="about[department]" id="department" placeholder="<?php echo vtranslate('LBL_DEPARTMENT', $_smarty_tpl->tpl_vars['MODULE']->value); ?> " style="width:250px;"><option value=""></option><!-- to allow select2 pick placeholder --><option value="Prefer Not to Disclose">Prefer Not to Disclose</option><option value="Administration">Administration</option><option value="Sales">Sales</option><option value="Marketing">Marketing</option><option value="Support/Customer Service">Support/Customer Service</option><option value="Information Technology">Information Technology</option><option value="Finance/Accounting">Finance/Accounting</option><option value="Business Development">Business Development</option><option value="Product Development">Product Development</option><option value="Professional Services">Professional Services</option><option value="Project Management">Project Management</option><option value="Other">Other</option></select><div style="padding-top:10px;"></div></div></div><?php } ?> <div class="span4"><label class="control-label"><strong>Preferences</strong> <span class="muted"><?php echo vtranslate('LBL_ALL_FIELDS_BELOW_ARE_REQUIRED', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </label><?php if ($_smarty_tpl->tpl_vars['IS_FIRST_USER']->value) { ?> <div class="controls" id="currency_name_controls"><select name="currency_name" id="currency_name" placeholder="<?php echo vtranslate('LBL_BASE_CURRENCY', $_smarty_tpl->tpl_vars['MODULE']->value); ?> " data-errormessage="<?php echo vtranslate('LBL_CHOOSE_BASE_CURRENCY', $_smarty_tpl->tpl_vars['MODULE']->value); ?> " class="validate[required]" style="width:250px;"><option value=""></option><?php $_smarty_tpl->tpl_vars['currency'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['currency']->_loop = false; $_smarty_tpl->tpl_vars['header'] = new Smarty_Variable(); $_from = $_smarty_tpl->tpl_vars['CURRENCIES']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['currency']->key => $_smarty_tpl->tpl_vars['currency']->value) { $_smarty_tpl->tpl_vars['currency']->_loop = true; $_smarty_tpl->tpl_vars['header']->value = $_smarty_tpl->tpl_vars['currency']->key; ?> <!--Open source fix to select user preferred currency during installation --><option value="<?php echo $_smarty_tpl->tpl_vars['header']->value; ?> " <?php if ($_smarty_tpl->tpl_vars['header']->value == $_smarty_tpl->tpl_vars['CURRENT_USER_MODEL']->value->get('currency_name')) { ?> selected<?php } ?> ><?php echo getTranslatedCurrencyString($_smarty_tpl->tpl_vars['header']->value); ?> (<?php echo $_smarty_tpl->tpl_vars['currency']->value[1]; ?> )</option><?php } ?> </select> <span rel="tooltip" title="<?php echo vtranslate('LBL_OPERATING_CURRENCY', $_smarty_tpl->tpl_vars['MODULE']->value); ?> " id="currency_name_tooltip" class="icon-info-sign"></span><div style="padding-top:10px;"></div></div><?php } ?> <div class="controls"><select name="lang_name" id="lang_name" style="width:250px;" placeholder="<?php echo vtranslate('LBL_LANGUAGE', $_smarty_tpl->tpl_vars['MODULE']->value); ?> " data-errormessage="<?php echo vtranslate('LBL_CHOOSE_LANGUAGE', $_smarty_tpl->tpl_vars['MODULE']->value); ?> " class="validate[required]"><option value=""></option><?php $_smarty_tpl->tpl_vars['language'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['language']->_loop = false; $_smarty_tpl->tpl_vars['header'] = new Smarty_Variable(); $_from = $_smarty_tpl->tpl_vars['LANGUAGES']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['language']->key => $_smarty_tpl->tpl_vars['language']->value) { $_smarty_tpl->tpl_vars['language']->_loop = true; $_smarty_tpl->tpl_vars['header']->value = $_smarty_tpl->tpl_vars['language']->key; ?> <option value="<?php echo $_smarty_tpl->tpl_vars['header']->value; ?> " <?php if ($_smarty_tpl->tpl_vars['header']->value == $_smarty_tpl->tpl_vars['CURRENT_USER_MODEL']->value->get('language')) { ?> selected<?php } ?> ><?php echo getTranslatedString($_smarty_tpl->tpl_vars['language']->value, $_smarty_tpl->tpl_vars['MODULE']->value); ?> </option><?php } ?> </select><div style="padding-top:10px;"></div></div><div class="controls"><select name="time_zone" id="time_zone" style="width:250px;" placeholder="<?php echo vtranslate('LBL_CHOOSE_TIMEZONE', $_smarty_tpl->tpl_vars['MODULE']->value); ?> " data-errormessage="<?php echo vtranslate('LBL_CHOOSE_TIMEZONE', $_smarty_tpl->tpl_vars['MODULE']->value); ?> " class="validate[required]"><option value=""></option><?php $_smarty_tpl->tpl_vars['time_zone'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['time_zone']->_loop = false; $_smarty_tpl->tpl_vars['header'] = new Smarty_Variable(); $_from = $_smarty_tpl->tpl_vars['TIME_ZONES']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['time_zone']->key => $_smarty_tpl->tpl_vars['time_zone']->value) { $_smarty_tpl->tpl_vars['time_zone']->_loop = true; $_smarty_tpl->tpl_vars['header']->value = $_smarty_tpl->tpl_vars['time_zone']->key; ?> <option value="<?php echo $_smarty_tpl->tpl_vars['header']->value; ?> " <?php if ($_smarty_tpl->tpl_vars['header']->value == $_smarty_tpl->tpl_vars['CURRENT_USER_MODEL']->value->get('time_zone')) { ?> selected<?php } ?> ><?php echo getTranslatedString($_smarty_tpl->tpl_vars['time_zone']->value, $_smarty_tpl->tpl_vars['MODULE']->value); ?> </option><?php } ?> </select><div style="padding-top:10px;"></div></div><div class="controls"><select name="date_format" id="date_format" style="width:250px;" placeholder="<?php echo vtranslate('LBL_DATE_FORMAT', $_smarty_tpl->tpl_vars['MODULE']->value); ?> " data-errormessage="<?php echo vtranslate('LBL_CHOOSE_DATE_FORMAT', $_smarty_tpl->tpl_vars['MODULE']->value); ?> " class="validate[required]"><option value=""></option><option value="dd-mm-yyyy" <?php if ($_smarty_tpl->tpl_vars['CURRENT_USER_MODEL']->value->get('date_format') == "dd-mm-yyyy") { ?> selected<?php } ?> >dd-mm-yyyy</option><option value="mm-dd-yyyy" <?php if ($_smarty_tpl->tpl_vars['CURRENT_USER_MODEL']->value->get('date_format') == "mm-dd-yyyy") { ?> selected<?php } ?> >mm-dd-yyyy</option><option value="yyyy-mm-dd" <?php if ($_smarty_tpl->tpl_vars['CURRENT_USER_MODEL']->value->get('date_format') == "yyyy-mm-dd") { ?> selected<?php } ?> >yyyy-mm-dd</option></select><div style="padding-top:10px;"></div></div></div></div></div><div class="modal-footer"><button class="btn btn-success" type="submit"><?php echo vtranslate('LBL_GET_STARTED', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </button></div></div></form></div></body></html> <?php }
<td width="50%" class="cellLabel small"><b>' . $mod_strings['LBL_CURRDEL'] . '</b></td> <td width="50%" class="cellText small"><b>' . getTranslatedCurrencyString($delete_currencyname) . '</b></td> </tr> <tr> <td class="cellLabel small"><b>' . $mod_strings['LBL_TRANSCURR'] . '</b></td> <td class="cellText small">'; $output .= '<select class="select small" name="transfer_currency_id" id="transfer_currency_id">'; global $adb; $sql = "select * from vtiger_currency_info where currency_status = ? and deleted=0"; $result = $adb->pquery($sql, array('Active')); $temprow = $adb->fetch_array($result); do { $currencyname = $temprow["currency_name"]; $currencyid = $temprow["id"]; if ($delete_currency_id != $currencyid) { $output .= '<option value="' . $currencyid . '">' . getTranslatedCurrencyString($currencyname) . '</option>'; } } while ($temprow = $adb->fetch_array($result)); $output .= '</td> </tr> </table> </td> </tr> </table> <table border=0 cellspacing=0 cellpadding=5 width=100% class="layerPopupTransport"> <tr> <td align="center"><input type="button" onclick="transferCurrency(' . $delete_currency_id . ')" name="Delete" value="' . $app_strings["LBL_SAVE_BUTTON_LABEL"] . '" class="crmbutton small save"> </td> </tr> </table> </form></div>';
public function getPDFMakerFieldValue($report, $picklistArray, $dbField, $valueArray, $fieldName) { global $current_user, $default_charset; $db = PearDatabase::getInstance(); $value = $valueArray[$fieldName]; $fld_type = $dbField->type; list($module, $fieldLabel) = explode('_', $dbField->name, 2); $fieldInfo = $this->getFieldByPDFMakerLabel($module, $fieldLabel); $fieldType = null; $fieldvalue = $value; if (!empty($fieldInfo)) { $field = WebserviceField::fromArray($db, $fieldInfo); $fieldType = $field->getFieldDataType(); } if ($fieldType == 'currency' && $value != '') { // Some of the currency fields like Unit Price, Total, Sub-total etc of Inventory modules, do not need currency conversion if ($field->getUIType() == '72') { $curid_value = explode("::", $value); $currency_id = $curid_value[0]; $currency_value = $curid_value[1]; $cur_sym_rate = getCurrencySymbolandCRate($currency_id); if ($value != '') { if ($dbField->name == 'Products_Unit_Price') { // need to do this only for Products Unit Price if ($currency_id != 1) { $currency_value = (double) $cur_sym_rate['rate'] * (double) $currency_value; } } $formattedCurrencyValue = CurrencyField::convertToUserFormat($currency_value, null, true); $fieldvalue = CurrencyField::appendCurrencySymbol($formattedCurrencyValue, $cur_sym_rate['symbol']); } } else { $currencyField = new CurrencyField($value); $fieldvalue = $currencyField->getDisplayValue(); } } elseif ($dbField->name == "PurchaseOrder_Currency" || $dbField->name == "SalesOrder_Currency" || $dbField->name == "Invoice_Currency" || $dbField->name == "Quotes_Currency" || $dbField->name == "PriceBooks_Currency") { if ($value != '') { $fieldvalue = getTranslatedCurrencyString($value); } } elseif (in_array($dbField->name, $this->ui101_fields) && !empty($value)) { $entityNames = getEntityName('Users', $value); $fieldvalue = $entityNames[$value]; } elseif ($fieldType == 'date' && !empty($value)) { if ($module == 'Calendar' && $field->getFieldName() == 'due_date') { $endTime = $valueArray['calendar_end_time']; if (empty($endTime)) { $recordId = $valueArray['calendar_id']; $endTime = getSingleFieldValue('vtiger_activity', 'time_end', 'activityid', $recordId); } $date = new DateTimeField($value . ' ' . $endTime); $fieldvalue = $date->getDisplayDate(); } else { $fieldvalue = DateTimeField::convertToUserFormat($value); } } elseif ($fieldType == "datetime" && !empty($value)) { $date = new DateTimeField($value); $fieldvalue = $date->getDisplayDateTimeValue(); } elseif ($fieldType == 'time' && !empty($value) && $field->getFieldName() != 'duration_hours') { if ($field->getFieldName() == "time_start" || $field->getFieldName() == "time_end") { $date = new DateTimeField($value); $fieldvalue = $date->getDisplayTime(); } else { $fieldvalue = $value; } } elseif ($fieldType == "picklist" && !empty($value)) { if (is_array($picklistArray)) { if (is_array($picklistArray[$dbField->name]) && $field->getFieldName() != 'activitytype' && !in_array($value, $picklistArray[$dbField->name])) { $fieldvalue = $app_strings['LBL_NOT_ACCESSIBLE']; } else { $fieldvalue = $this->getTranslatedString($value, $module); } } else { $fieldvalue = $this->getTranslatedString($value, $module); } } elseif ($fieldType == "multipicklist" && !empty($value)) { if (is_array($picklistArray[1])) { $valueList = explode(' |##| ', $value); $translatedValueList = array(); foreach ($valueList as $value) { if (is_array($picklistArray[1][$dbField->name]) && !in_array($value, $picklistArray[1][$dbField->name])) { $translatedValueList[] = $app_strings['LBL_NOT_ACCESSIBLE']; } else { $translatedValueList[] = $this->getTranslatedString($value, $module); } } } if (!is_array($picklistArray[1]) || !is_array($picklistArray[1][$dbField->name])) { $fieldvalue = str_replace(' |##| ', ', ', $value); } else { implode(', ', $translatedValueList); } } elseif ($fieldType == 'double') { if ($current_user->truncate_trailing_zeros == true) { $fieldvalue = decimalFormat($fieldvalue); } } if ($fieldvalue == "") { return "-"; } $fieldvalue = str_replace("<", "<", $fieldvalue); $fieldvalue = str_replace(">", ">", $fieldvalue); $fieldvalue = decode_html($fieldvalue); if (stristr($fieldvalue, "|##|") && empty($fieldType)) { $fieldvalue = str_ireplace(' |##| ', ', ', $fieldvalue); } elseif ($fld_type == "date" && empty($fieldType)) { $fieldvalue = DateTimeField::convertToUserFormat($fieldvalue); } elseif ($fld_type == "datetime" && empty($fieldType)) { $date = new DateTimeField($fieldvalue); $fieldvalue = $date->getDisplayDateTimeValue(); } // Added to render html tag for description fields if ($fieldInfo['uitype'] == '19' && ($module == 'Documents' || $module == 'Emails')) { return $fieldvalue; } return htmlentities($fieldvalue, ENT_QUOTES, $default_charset); }
/** This function returns a HTML output of associated vtiger_products for a given entity (Quotes,Invoice,Sales order or Purchase order) * Param $module - module name * Param $focus - module object * Return type string */ function getDetailAssociatedProducts($module, $focus) { global $log; $log->debug("Entering getDetailAssociatedProducts(" . $module . "," . get_class($focus) . ") method ..."); global $adb; global $mod_strings; global $theme; global $log; global $app_strings, $current_user; $theme_path = "themes/" . $theme . "/"; $image_path = $theme_path . "images/"; if (vtlib_isModuleActive("Products")) { $hide_stock = 'no'; } else { $hide_stock = 'yes'; } if ($module != 'PurchaseOrder') { if (GlobalVariable::getVariable('B2B', '1') == '1') { $acvid = $focus->column_fields['account_id']; } else { $acvid = $focus->column_fields['contact_id']; } if ($hide_stock == 'no') { $colspan = '2'; } else { $colspan = '1'; } } else { $acvid = $focus->column_fields['vendor_id']; $colspan = '1'; } //Get the taxtype of this entity $taxtype = getInventoryTaxType($module, $focus->id); $currencytype = getInventoryCurrencyInfo($module, $focus->id); $output = ''; //Header Rows $output .= ' <table width="100%" border="0" align="center" cellpadding="5" cellspacing="0" class="crmTable" id="proTab"> <tr valign="top"> <td colspan="' . $colspan . '" class="dvInnerHeader"><b>' . $app_strings['LBL_ITEM_DETAILS'] . '</b></td> <td class="dvInnerHeader" align="center" colspan="2"><b>' . $app_strings['LBL_CURRENCY'] . ' : </b>' . getTranslatedCurrencyString($currencytype['currency_name']) . ' (' . $currencytype['currency_symbol'] . ') </td> <td class="dvInnerHeader" align="center" colspan="2"><b>' . $app_strings['LBL_TAX_MODE'] . ' : </b>' . $app_strings[$taxtype] . ' </td> </tr> <tr valign="top"> <td width=40% class="lvtCol"><font color="red">*</font> <b>' . $app_strings['LBL_ITEM_NAME'] . '</b> </td>'; //Add Quantity in Stock column for SO, Quotes and Invoice if (($module == 'Quotes' || $module == 'SalesOrder' || $module == 'Invoice') && $hide_stock == 'no') { $output .= '<td width=10% class="lvtCol"><b>' . $app_strings['LBL_QTY_IN_STOCK'] . '</b></td>'; } $output .= ' <td width=10% class="lvtCol"><b>' . $app_strings['LBL_QTY'] . '</b></td> <td width=10% class="lvtCol" align="right"><b>' . $app_strings['LBL_LIST_PRICE'] . '</b></td> <td width=12% nowrap class="lvtCol" align="right"><b>' . $app_strings['LBL_TOTAL'] . '</b></td> <td width=13% valign="top" class="lvtCol" align="right"><b>' . $app_strings['LBL_NET_PRICE'] . '</b></td> </tr> '; // DG 15 Aug 2006 // Add "ORDER BY sequence_no" to retain add order on all inventoryproductrel items if ($module == 'Quotes' || $module == 'PurchaseOrder' || $module == 'SalesOrder' || $module == 'Invoice') { $query = "select case when vtiger_products.productid != '' then vtiger_products.productname else vtiger_service.servicename end as productname," . " case when vtiger_products.productid != '' then 'Products' else 'Services' end as entitytype," . " case when vtiger_products.productid != '' then vtiger_products.unit_price else vtiger_service.unit_price end as unit_price," . " case when vtiger_products.productid != '' then vtiger_products.qtyinstock else 'NA' end as qtyinstock, vtiger_inventoryproductrel.* " . " from vtiger_inventoryproductrel" . " left join vtiger_products on vtiger_products.productid=vtiger_inventoryproductrel.productid " . " left join vtiger_service on vtiger_service.serviceid=vtiger_inventoryproductrel.productid " . " where id=? ORDER BY sequence_no"; } $result = $adb->pquery($query, array($focus->id)); $num_rows = $adb->num_rows($result); $netTotal = '0.00'; for ($i = 1; $i <= $num_rows; $i++) { $sub_prod_query = $adb->pquery("SELECT productid from vtiger_inventorysubproductrel WHERE id=? AND sequence_no=?", array($focus->id, $i)); $subprodname_str = ''; if ($adb->num_rows($sub_prod_query) > 0) { for ($j = 0; $j < $adb->num_rows($sub_prod_query); $j++) { $sprod_id = $adb->query_result($sub_prod_query, $j, 'productid'); $sprod_name = getProductName($sprod_id); $str_sep = ""; if ($j > 0) { $str_sep = ":"; } $subprodname_str .= $str_sep . " - " . $sprod_name; } } $subprodname_str = str_replace(":", "<br>", $subprodname_str); $productid = $adb->query_result($result, $i - 1, 'productid'); $entitytype = $adb->query_result($result, $i - 1, 'entitytype'); $productname = $adb->query_result($result, $i - 1, 'productname'); $productname = '<a href="index.php?action=DetailView&record=' . $productid . '&module=' . $entitytype . '">' . $productname . '</a>'; if ($subprodname_str != '') { $productname .= "<br/><span style='color:#C0C0C0;font-style:italic;'>" . $subprodname_str . "</span>"; } $comment = $adb->query_result($result, $i - 1, 'comment'); $qtyinstock = $adb->query_result($result, $i - 1, 'qtyinstock'); $qty = $adb->query_result($result, $i - 1, 'quantity'); $qty = number_format($qty, 2, '.', ''); //Convert to 2 decimals $unitprice = $adb->query_result($result, $i - 1, 'unit_price'); $listprice = $adb->query_result($result, $i - 1, 'listprice'); $total = $qty * $listprice; $listprice = number_format($listprice, 2, '.', ''); //Convert to 2 decimals //Product wise Discount calculation - starts $discount_percent = $adb->query_result($result, $i - 1, 'discount_percent'); $discount_amount = $adb->query_result($result, $i - 1, 'discount_amount'); $totalAfterDiscount = $total; $productDiscount = '0.00'; if ($discount_percent != 'NULL' && $discount_percent != '') { $productDiscount = $total * $discount_percent / 100; $productDiscount = number_format($productDiscount, 2, '.', ''); $totalAfterDiscount = $total - $productDiscount; //if discount is percent then show the percentage $discount_info_message = "{$discount_percent} % of " . CurrencyField::convertToUserFormat($total, null, true) . " = " . CurrencyField::convertToUserFormat($productDiscount, null, true); } elseif ($discount_amount != 'NULL' && $discount_amount != '') { $productDiscount = $discount_amount; $productDiscount = number_format($productDiscount, 2, '.', ''); $totalAfterDiscount = $total - $productDiscount; $discount_info_message = $app_strings['LBL_DIRECT_AMOUNT_DISCOUNT'] . " = " . CurrencyField::convertToUserFormat($productDiscount, null, true); } else { $discount_info_message = $app_strings['LBL_NO_DISCOUNT_FOR_THIS_LINE_ITEM']; } //Product wise Discount calculation - ends $totalAfterDiscount = number_format($totalAfterDiscount, 2, '.', ''); //Convert to 2 decimals $netprice = $totalAfterDiscount; //Calculate the individual tax if taxtype is individual if ($taxtype == 'individual') { $taxtotal = '0.00'; $tax_info_message = $app_strings['LBL_TOTAL_AFTER_DISCOUNT'] . " = " . CurrencyField::convertToUserFormat($totalAfterDiscount, null, true) . " \\n"; $tax_details = getTaxDetailsForProduct($productid, 'all', $acvid); for ($tax_count = 0; $tax_count < count($tax_details); $tax_count++) { $tax_name = $tax_details[$tax_count]['taxname']; $tax_label = $tax_details[$tax_count]['taxlabel']; $tax_value = getInventoryProductTaxValue($focus->id, $productid, $tax_name); $individual_taxamount = $totalAfterDiscount * $tax_value / 100; $individual_taxamount = number_format($individual_taxamount, 2, '.', ''); //Convert to 2 decimals $taxtotal = $taxtotal + $individual_taxamount; $taxtotal = number_format($taxtotal, 2, '.', ''); //Convert to 2 decimals $tax_info_message .= "{$tax_label} : {$tax_value} % = " . CurrencyField::convertToUserFormat($individual_taxamount, null, true) . " \\n"; } $tax_info_message .= "\\n " . $app_strings['LBL_TOTAL_TAX_AMOUNT'] . " = " . CurrencyField::convertToUserFormat($taxtotal, null, true); $netprice = $netprice + $taxtotal; $netprice = number_format($netprice, 2, '.', ''); //Convert to 2 decimals } $sc_image_tag = ''; if ($module == 'Invoice') { switch ($entitytype) { case 'Services': if (vtlib_isModuleActive('ServiceContracts')) { $sc_image_tag = '<a href="index.php?module=ServiceContracts&action=EditView&service_id=' . $productid . '&sc_related_to=' . $focus->column_fields['account_id'] . '&start_date=' . DateTimeField::convertToUserFormat($focus->column_fields['invoicedate']) . '&return_module=' . $module . '&return_id=' . $focus->id . '">' . '<img border="0" src="' . vtiger_imageurl('handshake.gif', $theme) . '" title="' . getTranslatedString('LBL_ADD_NEW', $module) . " " . getTranslatedString('ServiceContracts', 'ServiceContracts') . '" style="cursor: pointer;" align="absmiddle" />' . '</a>'; } break; case 'Products': if (vtlib_isModuleActive('Assets')) { $sc_image_tag = '<a href="index.php?module=Assets&action=EditView&invoiceid=' . $focus->id . '&product=' . $productid . '&account=' . $focus->column_fields['account_id'] . '&datesold=' . DateTimeField::convertToUserFormat($focus->column_fields['invoicedate']) . '&return_module=' . $module . '&return_id=' . $focus->id . '" onmouseout="vtlib_listview.trigger(\'invoiceasset.onmouseout\', $(this))" onmouseover="vtlib_listview.trigger(\'cell.onmouseover\', $(this))">' . '<img border="0" src="' . vtiger_imageurl('barcode.png', $theme) . '" title="' . getTranslatedString('LBL_ADD_NEW', $module) . " " . getTranslatedString('Assets', 'Assets') . '" style="cursor: pointer;" align="absmiddle" />' . '<span style="display:none;" vtmodule="Assets" vtfieldname="invoice_product" vtrecordid="' . $focus->id . '::' . $productid . '::' . $i . '" type="vtlib_metainfo"></span>' . '</a>'; } break; default: $sc_image_tag = ''; } } //For Product Name $output .= ' <tr valign="top"> <td class="crmTableRow small lineOnTop"> ' . $productname . ' ' . $sc_image_tag . ' <br>' . $comment . ' </td>'; //Upto this added to display the Product name and comment if ($module != 'PurchaseOrder' && $hide_stock == 'no') { $output .= '<td class="crmTableRow small lineOnTop">' . $qtyinstock . '</td>'; } $output .= '<td class="crmTableRow small lineOnTop">' . $qty . '</td>'; $output .= ' <td class="crmTableRow small lineOnTop" align="right"> <table width="100%" border="0" cellpadding="5" cellspacing="0"> <tr> <td align="right">' . CurrencyField::convertToUserFormat($listprice, null, true) . '</td> </tr> <tr> <td align="right">(-) <b><a href="javascript:;" onclick="alert(\'' . $discount_info_message . '\'); ">' . $app_strings['LBL_DISCOUNT'] . ' : </a></b></td> </tr> <tr> <td align="right" nowrap>' . $app_strings['LBL_TOTAL_AFTER_DISCOUNT'] . ' : </td> </tr>'; if ($taxtype == 'individual') { $output .= ' <tr> <td align="right" nowrap>(+) <b><a href="javascript:;" onclick="alert(\'' . $tax_info_message . '\');">' . $app_strings['LBL_TAX'] . ' : </a></b></td> </tr>'; } $output .= ' </table> </td>'; $output .= ' <td class="crmTableRow small lineOnTop" align="right"> <table width="100%" border="0" cellpadding="5" cellspacing="0"> <tr><td align="right">' . CurrencyField::convertToUserFormat($total, null, true) . '</td></tr> <tr><td align="right">' . CurrencyField::convertToUserFormat($productDiscount, null, true) . '</td></tr> <tr><td align="right" nowrap>' . CurrencyField::convertToUserFormat($totalAfterDiscount, null, true) . '</td></tr>'; if ($taxtype == 'individual') { $output .= '<tr><td align="right" nowrap>' . CurrencyField::convertToUserFormat($taxtotal, null, true) . '</td></tr>'; } $output .= ' </table> </td>'; $output .= '<td class="crmTableRow small lineOnTop" valign="bottom" align="right">' . CurrencyField::convertToUserFormat($netprice, null, true) . '</td>'; $output .= '</tr>'; $netTotal = $netTotal + $netprice; } $output .= '</table>'; //$netTotal should be equal to $focus->column_fields['hdnSubTotal'] $netTotal = $focus->column_fields['hdnSubTotal']; $netTotal = number_format($netTotal, 2, '.', ''); //Convert to 2 decimals //Display the total, adjustment, S&H details $output .= '<table width="100%" border="0" cellspacing="0" cellpadding="5" class="crmTable">'; $output .= '<tr>'; $output .= '<td width="88%" class="crmTableRow small" align="right"><b>' . $app_strings['LBL_NET_TOTAL'] . '</td>'; $output .= '<td width="12%" class="crmTableRow small" align="right"><b>' . CurrencyField::convertToUserFormat($netTotal, null, true) . '</b></td>'; $output .= '</tr>'; //Decide discount $finalDiscount = '0.00'; $final_discount_info = '0'; //if($focus->column_fields['hdnDiscountPercent'] != '') - previously (before changing to prepared statement) the selected option (either percent or amount) will have value and the other remains empty. So we can find the non selected item by empty check. But now with prepared statement, the non selected option stored as 0 if ($focus->column_fields['hdnDiscountPercent'] != '0') { $finalDiscount = $netTotal * $focus->column_fields['hdnDiscountPercent'] / 100; $finalDiscount = number_format($finalDiscount, 2, '.', ''); $final_discount_info = $focus->column_fields['hdnDiscountPercent'] . " % of " . CurrencyField::convertToUserFormat($netTotal, null, true) . " = " . CurrencyField::convertToUserFormat($finalDiscount, null, true); } elseif ($focus->column_fields['hdnDiscountAmount'] != '0') { $finalDiscount = $focus->column_fields['hdnDiscountAmount']; $finalDiscount = number_format($finalDiscount, 2, '.', ''); $final_discount_info = CurrencyField::convertToUserFormat($finalDiscount, null, true); } //Alert the Final Discount amount even it is zero $final_discount_info = $app_strings['LBL_FINAL_DISCOUNT_AMOUNT'] . " = {$final_discount_info}"; $final_discount_info = 'onclick="alert(\'' . $final_discount_info . '\');"'; $output .= '<tr>'; $output .= '<td align="right" class="crmTableRow small lineOnTop">(-) <b><a href="javascript:;" ' . $final_discount_info . '>' . $app_strings['LBL_DISCOUNT'] . '</a></b></td>'; $output .= '<td align="right" class="crmTableRow small lineOnTop">' . CurrencyField::convertToUserFormat($finalDiscount, null, true) . '</td>'; $output .= '</tr>'; if ($taxtype == 'group') { $taxtotal = '0.00'; $final_totalAfterDiscount = $netTotal - $finalDiscount; $tax_info_message = $app_strings['LBL_TOTAL_AFTER_DISCOUNT'] . " = " . CurrencyField::convertToUserFormat($final_totalAfterDiscount, null, true) . " \\n"; //First we should get all available taxes and then retrieve the corresponding tax values $tax_details = getAllTaxes('available', '', 'edit', $focus->id); $ipr_cols = $adb->getColumnNames('vtiger_inventoryproductrel'); //if taxtype is group then the tax should be same for all products in vtiger_inventoryproductrel table for ($tax_count = 0; $tax_count < count($tax_details); $tax_count++) { $tax_name = $tax_details[$tax_count]['taxname']; $tax_label = $tax_details[$tax_count]['taxlabel']; if (in_array($tax_name, $ipr_cols)) { $tax_value = $adb->query_result($result, 0, $tax_name); } else { $tax_value = $tax_details[$tax_count]['percentage']; } if ($tax_value == '' || $tax_value == 'NULL') { $tax_value = '0.00'; } $taxamount = ($netTotal - $finalDiscount) * $tax_value / 100; $taxtotal = $taxtotal + $taxamount; $tax_info_message .= "{$tax_label} : {$tax_value} % = " . CurrencyField::convertToUserFormat($taxtotal, null, true) . " \\n"; } $tax_info_message .= "\\n " . $app_strings['LBL_TOTAL_TAX_AMOUNT'] . " = " . CurrencyField::convertToUserFormat($taxtotal, null, true); $output .= '<tr>'; $output .= '<td align="right" class="crmTableRow small">(+) <b><a href="javascript:;" onclick="alert(\'' . $tax_info_message . '\');">' . $app_strings['LBL_TAX'] . '</a></b></td>'; $output .= '<td align="right" class="crmTableRow small">' . CurrencyField::convertToUserFormat($taxtotal, null, true) . '</td>'; $output .= '</tr>'; } $shAmount = $focus->column_fields['hdnS_H_Amount'] != '' ? $focus->column_fields['hdnS_H_Amount'] : '0.00'; $shAmount = number_format($shAmount, 2, '.', ''); //Convert to 2 decimals $output .= '<tr>'; $output .= '<td align="right" class="crmTableRow small">(+) <b>' . $app_strings['LBL_SHIPPING_AND_HANDLING_CHARGES'] . '</b></td>'; $output .= '<td align="right" class="crmTableRow small">' . CurrencyField::convertToUserFormat($shAmount, null, true) . '</td>'; $output .= '</tr>'; //calculate S&H tax $shtaxtotal = '0.00'; //First we should get all available taxes and then retrieve the corresponding tax values $shtax_details = getAllTaxes('available', 'sh', 'edit', $focus->id); //if taxtype is group then the tax should be same for all products in vtiger_inventoryproductrel table $shtax_info_message = $app_strings['LBL_SHIPPING_AND_HANDLING_CHARGE'] . " = " . CurrencyField::convertToUserFormat($shAmount, null, true) . "\\n"; for ($shtax_count = 0; $shtax_count < count($shtax_details); $shtax_count++) { $shtax_name = $shtax_details[$shtax_count]['taxname']; $shtax_label = $shtax_details[$shtax_count]['taxlabel']; $shtax_percent = getInventorySHTaxPercent($focus->id, $shtax_name); $shtaxamount = $shAmount * $shtax_percent / 100; $shtaxamount = number_format($shtaxamount, 2, '.', ''); $shtaxtotal = $shtaxtotal + $shtaxamount; $shtax_info_message .= "{$shtax_label} : {$shtax_percent} % = " . CurrencyField::convertToUserFormat($shtaxamount, null, true) . " \\n"; } $shtax_info_message .= "\\n " . $app_strings['LBL_TOTAL_TAX_AMOUNT'] . " = " . CurrencyField::convertToUserFormat($shtaxtotal, null, true); $output .= '<tr>'; $output .= '<td align="right" class="crmTableRow small">(+) <b><a href="javascript:;" onclick="alert(\'' . $shtax_info_message . '\')">' . $app_strings['LBL_TAX_FOR_SHIPPING_AND_HANDLING'] . '</a></b></td>'; $output .= '<td align="right" class="crmTableRow small">' . CurrencyField::convertToUserFormat($shtaxtotal, null, true) . '</td>'; $output .= '</tr>'; $adjustment = $focus->column_fields['txtAdjustment'] != '' ? $focus->column_fields['txtAdjustment'] : '0.00'; $adjustment = number_format($adjustment, 2, '.', ''); //Convert to 2 decimals $output .= '<tr>'; $output .= '<td align="right" class="crmTableRow small"> <b>' . $app_strings['LBL_ADJUSTMENT'] . '</b></td>'; $output .= '<td align="right" class="crmTableRow small">' . CurrencyField::convertToUserFormat($adjustment, null, true) . '</td>'; $output .= '</tr>'; $grandTotal = $focus->column_fields['hdnGrandTotal'] != '' ? $focus->column_fields['hdnGrandTotal'] : '0.00'; $grandTotal = number_format($grandTotal, 2, '.', ''); //Convert to 2 decimals $output .= '<tr>'; $output .= '<td align="right" class="crmTableRow small lineOnTop"><b>' . $app_strings['LBL_GRAND_TOTAL'] . '</b></td>'; $output .= '<td align="right" class="crmTableRow small lineOnTop">' . CurrencyField::convertToUserFormat($grandTotal, null, true) . '</td>'; $output .= '</tr>'; $output .= '</table>'; $log->debug("Exiting getDetailAssociatedProducts method ..."); return $output; }
/** * * @global Users $current_user * @param ReportRun $report * @param Array $picklistArray * @param ADOFieldObject $dbField * @param Array $valueArray * @param String $fieldName * @return String */ function getReportFieldValue($report, $picklistArray, $dbField, $valueArray, $fieldName) { global $current_user, $default_charset; $db = PearDatabase::getInstance(); $value = $valueArray[$fieldName]; $fld_type = $dbField->type; list($module, $fieldLabel) = explode('__', $dbField->name, 2); $fieldInfo = getFieldByReportLabel($module, $fieldLabel); $fieldType = null; $fieldvalue = $value; if (!empty($fieldInfo)) { $field = WebserviceField::fromArray($db, $fieldInfo); $fieldType = $field->getFieldDataType(); } if ($fieldType == 'currency' && $value != '') { // Some of the currency fields like Unit Price, Total, Sub-total etc of Inventory modules, do not need currency conversion if ($field->getUIType() == '72') { $curid_value = explode("::", $value); $currency_id = $curid_value[0]; $currency_value = $curid_value[1]; $cur_sym_rate = getCurrencySymbolandCRate($currency_id); if ($value != '') { if ($dbField->name == 'Products_Unit_Price') { // need to do this only for Products Unit Price if ($currency_id != 1) { $currency_value = (double) $cur_sym_rate['rate'] * (double) $currency_value; } } $formattedCurrencyValue = CurrencyField::convertToUserFormat($currency_value, null, true); $fieldvalue = CurrencyField::appendCurrencySymbol($formattedCurrencyValue, $cur_sym_rate['symbol']); } } else { $currencyField = new CurrencyField($value); $fieldvalue = $currencyField->getDisplayValue(); } } elseif ($dbField->name == "PriceBooks_Currency") { if ($value != '') { $fieldvalue = getTranslatedCurrencyString($value); } } elseif (in_array($dbField->name, $report->ui101_fields) && !empty($value)) { $entityNames = getEntityName('Users', $value); $fieldvalue = $entityNames[$value]; } elseif ($fieldType == 'date' && !empty($value)) { if ($module == 'Calendar' && $field->getFieldName() == 'due_date') { $endTime = $valueArray['calendar_end_time']; if (empty($endTime)) { $recordId = $valueArray['calendar_id']; $endTime = getSingleFieldValue('vtiger_activity', 'time_end', 'activityid', $recordId); } $date = new DateTimeField($value . ' ' . $endTime); $fieldvalue = $date->getDisplayDate(); } else { if (!($field->getUIType() == '5')) { $date = new DateTimeField($fieldvalue); $fieldvalue = $date->getDisplayDateTimeValue(); } } } elseif ($fieldType == "datetime" && !empty($value)) { $date = new DateTimeField($value); $fieldvalue = $date->getDisplayDateTimeValue(); } elseif ($fieldType == 'time' && !empty($value) && $field->getFieldName() != 'duration_hours') { if ($field->getFieldName() == "time_start" || $field->getFieldName() == "time_end") { $date = new DateTimeField($value); $fieldvalue = $date->getDisplayTime(); } else { $userModel = Users_Privileges_Model::getCurrentUserModel(); if ($userModel->get('hour_format') == '12') { $value = Vtiger_Time_UIType::getTimeValueInAMorPM($value); } $fieldvalue = $value; } } elseif ($fieldType == "picklist" && !empty($value)) { if (is_array($picklistArray)) { if (is_array($picklistArray[$dbField->name]) && $field->getFieldName() != 'activitytype' && !in_array($value, $picklistArray[$dbField->name])) { $fieldvalue = $app_strings['LBL_NOT_ACCESSIBLE']; } else { $fieldvalue = getTranslatedString($value, $module); } } else { $fieldvalue = getTranslatedString($value, $module); } } elseif ($fieldType == "multipicklist" && !empty($value)) { if (is_array($picklistArray[1])) { $valueList = explode(' |##| ', $value); $translatedValueList = array(); foreach ($valueList as $value) { if (is_array($picklistArray[1][$dbField->name]) && !in_array($value, $picklistArray[1][$dbField->name])) { $translatedValueList[] = $app_strings['LBL_NOT_ACCESSIBLE']; } else { $translatedValueList[] = getTranslatedString($value, $module); } } } if (!is_array($picklistArray[1]) || !is_array($picklistArray[1][$dbField->name])) { $fieldvalue = str_replace(' |##| ', ', ', $value); } else { implode(', ', $translatedValueList); } } elseif ($fieldType == 'double') { if ($current_user->truncate_trailing_zeros == true) { $fieldvalue = decimalFormat($fieldvalue); } } elseif ($fieldType == 'boolean') { if (strtolower($value) === 'yes' || strtolower($value) === 'on' || $value == 1) { $fieldvalue = vtranslate('LBL_YES'); } else { $fieldvalue = vtranslate('LBL_NO'); } } elseif ($field && $field->getUIType() == 117 && $value != '') { if ($value != '0') { $currencyList = Settings_Currency_Record_Model::getAll(); $fieldvalue = $currencyList[$value]->getName() . ' (' . $currencyList[$value]->get('currency_symbol') . ')'; } else { $fieldvalue = '-'; } } if ('vtiger_crmentity' == $dbField->table && false != strpos($dbField->name, 'Share__with__users')) { if ($value) { $listId = explode(',', $value); $usersSqlFullName = getSqlForNameInDisplayFormat(['first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'], 'Users'); $getListUserSql = "select {$usersSqlFullName} as uname from vtiger_users WHERE id IN (" . generateQuestionMarks($listId) . ') '; $getListUserResult = $db->pquery($getListUserSql, array($listId), TRUE); $fieldvalue = ''; $finalList = array(); $listUsers = $getListUserResult->GetAll(); for ($i = 0; $i < count($listUsers); $i++) { $finalList[] = $listUsers[$i][0]; } $fieldvalue = implode(', ', $finalList); } } if ($fieldvalue == "") { return "-"; } $fieldvalue = str_replace("<", "<", $fieldvalue); $fieldvalue = str_replace(">", ">", $fieldvalue); $fieldvalue = decode_html($fieldvalue); if (stristr($fieldvalue, "|##|") && empty($fieldType)) { $fieldvalue = str_ireplace(' |##| ', ', ', $fieldvalue); } elseif ($fld_type == "date" && empty($fieldType)) { $fieldvalue = DateTimeField::convertToUserFormat($fieldvalue); } elseif ($fld_type == "datetime" && empty($fieldType)) { $date = new DateTimeField($fieldvalue); $fieldvalue = $date->getDisplayDateTimeValue(); } // Added to render html tag for description fields if ($fieldInfo['uitype'] == '19' && ($module == 'Documents' || $module == 'Emails')) { return $fieldvalue; } return htmlentities($fieldvalue, ENT_QUOTES, $default_charset); }
function content_5674ee6c9afb5($_smarty_tpl) { ?> <!--All final details are stored in the first element in the array with the index name as final_detailsso we will get that array, parse that array and fill the details--><?php $_smarty_tpl->tpl_vars["FINAL"] = new Smarty_variable($_smarty_tpl->tpl_vars['RELATED_PRODUCTS']->value[1]['final_details'], null, 0); $_smarty_tpl->tpl_vars["IS_INDIVIDUAL_TAX_TYPE"] = new Smarty_variable(false, null, 0); $_smarty_tpl->tpl_vars["IS_GROUP_TAX_TYPE"] = new Smarty_variable(true, null, 0); if ($_smarty_tpl->tpl_vars['FINAL']->value['taxtype'] == 'individual') { $_smarty_tpl->tpl_vars["IS_GROUP_TAX_TYPE"] = new Smarty_variable(false, null, 0); $_smarty_tpl->tpl_vars["IS_INDIVIDUAL_TAX_TYPE"] = new Smarty_variable(true, null, 0); } ?> <input type="hidden" class="numberOfCurrencyDecimal" value="<?php echo $_smarty_tpl->tpl_vars['USER_MODEL']->value->get('no_of_currency_decimals'); ?> " /><table class="table table-bordered blockContainer lineItemTable" id="lineItemTab"><tr><th colspan="2"><span class="inventoryLineItemHeader"><?php echo vtranslate('LBL_ITEM_DETAILS', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </span></th><th colspan="2" class="chznDropDown"><div class="row-fluid"><span class="inventoryLineItemHeader"><?php echo vtranslate('LBL_CURRENCY', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </span> <?php $_smarty_tpl->tpl_vars['SELECTED_CURRENCY'] = new Smarty_variable($_smarty_tpl->tpl_vars['CURRENCINFO']->value, null, 0); if ($_smarty_tpl->tpl_vars['SELECTED_CURRENCY']->value == '') { $_smarty_tpl->tpl_vars['USER_CURRENCY_ID'] = new Smarty_variable($_smarty_tpl->tpl_vars['USER_MODEL']->value->get('currency_id'), null, 0); $_smarty_tpl->tpl_vars['currency_details'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['currency_details']->_loop = false; $_from = $_smarty_tpl->tpl_vars['CURRENCIES']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['currency_details']->key => $_smarty_tpl->tpl_vars['currency_details']->value) { $_smarty_tpl->tpl_vars['currency_details']->_loop = true; if ($_smarty_tpl->tpl_vars['currency_details']->value['curid'] == $_smarty_tpl->tpl_vars['USER_CURRENCY_ID']->value) { $_smarty_tpl->tpl_vars['SELECTED_CURRENCY'] = new Smarty_variable($_smarty_tpl->tpl_vars['currency_details']->value, null, 0); } } } ?> <select class="chzn-select" id="currency_id" name="currency_id" style="width: 164px;"><?php $_smarty_tpl->tpl_vars['currency_details'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['currency_details']->_loop = false; $_smarty_tpl->tpl_vars['count'] = new Smarty_Variable(); $_from = $_smarty_tpl->tpl_vars['CURRENCIES']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['currency_details']->key => $_smarty_tpl->tpl_vars['currency_details']->value) { $_smarty_tpl->tpl_vars['currency_details']->_loop = true; $_smarty_tpl->tpl_vars['count']->value = $_smarty_tpl->tpl_vars['currency_details']->key; ?> <option value="<?php echo $_smarty_tpl->tpl_vars['currency_details']->value['curid']; ?> " class="textShadowNone" data-conversion-rate="<?php echo $_smarty_tpl->tpl_vars['currency_details']->value['conversionrate']; ?> " <?php if ($_smarty_tpl->tpl_vars['SELECTED_CURRENCY']->value['currency_id'] == $_smarty_tpl->tpl_vars['currency_details']->value['curid']) { ?> selected <?php } ?> ><?php echo getTranslatedCurrencyString($_smarty_tpl->tpl_vars['currency_details']->value['currencylabel']); ?> (<?php echo $_smarty_tpl->tpl_vars['currency_details']->value['currencysymbol']; ?> )</option><?php } ?> </select><?php $_smarty_tpl->tpl_vars["RECORD_CURRENCY_RATE"] = new Smarty_variable($_smarty_tpl->tpl_vars['RECORD_STRUCTURE_MODEL']->value->getRecord()->get('conversion_rate'), null, 0); if ($_smarty_tpl->tpl_vars['RECORD_CURRENCY_RATE']->value == '') { $_smarty_tpl->tpl_vars["RECORD_CURRENCY_RATE"] = new Smarty_variable($_smarty_tpl->tpl_vars['SELECTED_CURRENCY']->value['conversionrate'], null, 0); } ?> <input type="hidden" name="conversion_rate" id="conversion_rate" value="<?php echo $_smarty_tpl->tpl_vars['RECORD_CURRENCY_RATE']->value; ?> " /><input type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['SELECTED_CURRENCY']->value['currency_id']; ?> " id="prev_selected_currency_id" /><!-- TODO : To get default currency in even better way than depending on first element --><input type="hidden" id="default_currency_id" value="<?php echo $_smarty_tpl->tpl_vars['CURRENCIES']->value[0]['curid']; ?> " /></div></th><th colspan="2" class="chznDropDown"><div class="row-fluid"><div class="inventoryLineItemHeader"><span class="alignTop"><?php echo vtranslate('LBL_TAX_MODE', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </span></div><select class="chzn-select lineItemTax" id="taxtype" name="taxtype" style="width: 164px;"><OPTION value="individual" <?php if ($_smarty_tpl->tpl_vars['IS_INDIVIDUAL_TAX_TYPE']->value) { ?> selected<?php } ?> ><?php echo vtranslate('LBL_INDIVIDUAL', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </OPTION><OPTION value="group" <?php if ($_smarty_tpl->tpl_vars['IS_GROUP_TAX_TYPE']->value) { ?> selected<?php } ?> ><?php echo vtranslate('LBL_GROUP', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </OPTION></select></div></th></tr><tr><td><b><?php echo vtranslate('LBL_TOOLS', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </b></td><td><span class="redColor">*</span><b><?php echo vtranslate('LBL_ITEM_NAME', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </b></td><td><b><?php echo vtranslate('LBL_QTY', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </b></td><td><b><?php echo vtranslate('LBL_LIST_PRICE', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </b></td><td><b class="pull-right"><?php echo vtranslate('LBL_TOTAL', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </b></td><td><b class="pull-right"><?php echo vtranslate('LBL_NET_PRICE', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </b></td></tr><tr id="row0" class="hide lineItemCloneCopy"><?php echo $_smarty_tpl->getSubTemplate(vtemplate_path("LineItemsContent.tpl", 'Inventory'), $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array('row_no' => 0, 'data' => array()), 0); ?> </tr><?php $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['data']->_loop = false; $_smarty_tpl->tpl_vars['row_no'] = new Smarty_Variable(); $_from = $_smarty_tpl->tpl_vars['RELATED_PRODUCTS']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['data']->key => $_smarty_tpl->tpl_vars['data']->value) { $_smarty_tpl->tpl_vars['data']->_loop = true; $_smarty_tpl->tpl_vars['row_no']->value = $_smarty_tpl->tpl_vars['data']->key; ?> <tr id="row<?php echo $_smarty_tpl->tpl_vars['row_no']->value; ?> " class="lineItemRow" <?php if ($_smarty_tpl->tpl_vars['data']->value["entityType" . $_smarty_tpl->tpl_vars['row_no']->value] == 'Products') { ?> data-quantity-in-stock=<?php echo $_smarty_tpl->tpl_vars['data']->value["qtyInStock" . $_smarty_tpl->tpl_vars['row_no']->value]; } ?> ><?php echo $_smarty_tpl->getSubTemplate(vtemplate_path("LineItemsContent.tpl", 'Inventory'), $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array('row_no' => $_smarty_tpl->tpl_vars['row_no']->value, 'data' => $_smarty_tpl->tpl_vars['data']->value), 0); ?> </tr><?php } if (count($_smarty_tpl->tpl_vars['RELATED_PRODUCTS']->value) == 0) { ?> <tr id="row1" class="lineItemRow"><?php echo $_smarty_tpl->getSubTemplate(vtemplate_path("LineItemsContent.tpl", 'Inventory'), $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array('row_no' => 1, 'data' => array()), 0); ?> </tr><?php } ?> </table><div class="row-fluid verticalBottomSpacing"><div><?php if ($_smarty_tpl->tpl_vars['PRODUCT_ACTIVE']->value == 'true' && $_smarty_tpl->tpl_vars['SERVICE_ACTIVE']->value == 'true') { ?> <div class="btn-toolbar"><span class="btn-group"><button type="button" class="btn addButton" id="addProduct"><i class="icon-plus"></i><strong><?php echo vtranslate('LBL_ADD_PRODUCT', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </strong></button></span><span class="btn-group"><button type="button" class="btn addButton" id="addService"><i class="icon-plus"></i><strong><?php echo vtranslate('LBL_ADD_SERVICE', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </strong></button></span></div><?php } elseif ($_smarty_tpl->tpl_vars['PRODUCT_ACTIVE']->value == 'true') { ?> <div class="btn-group"><button type="button" class="btn addButton" id="addProduct"><i class="icon-plus"></i><strong> <?php echo vtranslate('LBL_ADD_PRODUCT', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </strong></button></div><?php } elseif ($_smarty_tpl->tpl_vars['SERVICE_ACTIVE']->value == 'true') { ?> <div class="btn-group"><button type="button" class="btn addButton" id="addService"><i class="icon-plus icon-white"></i><strong> <?php echo vtranslate('LBL_ADD_SERVICE', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </strong></button></div><?php } ?> </div></div><table class="table table-bordered blockContainer lineItemTable" id="lineItemResult"><tr style="display:none;"><td width="83%"><div class="pull-right"><strong><?php echo vtranslate('LBL_ITEMS_TOTAL', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </strong></div></td><td><div id="netTotal" class="pull-right netTotal"><?php if (!empty($_smarty_tpl->tpl_vars['FINAL']->value['hdnSubTotal'])) { echo $_smarty_tpl->tpl_vars['FINAL']->value['hdnSubTotal']; } else { ?> 0<?php } ?> </div></td></tr><tr><td width="83%"><span class="pull-right">(-) <b><a href="javascript:void(0)" id="finalDiscount"><?php echo vtranslate('LBL_DISCOUNT', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </a></b></span></td><td><span id="discountTotal_final" class="pull-right discountTotal_final"><?php if ($_smarty_tpl->tpl_vars['FINAL']->value['discountTotal_final']) { echo $_smarty_tpl->tpl_vars['FINAL']->value['discountTotal_final']; } else { ?> 0<?php } ?> </span><!-- Popup Discount Div --><div id="finalDiscountUI" class="finalDiscountUI validCheck hide"><?php $_smarty_tpl->tpl_vars['DISCOUNT_TYPE_FINAL'] = new Smarty_variable("zero", null, 0); if (!empty($_smarty_tpl->tpl_vars['FINAL']->value['discount_type_final'])) { $_smarty_tpl->tpl_vars['DISCOUNT_TYPE_FINAL'] = new Smarty_variable($_smarty_tpl->tpl_vars['FINAL']->value['discount_type_final'], null, 0); } ?> <input type="hidden" id="discount_type_final" name="discount_type_final" value="<?php echo $_smarty_tpl->tpl_vars['DISCOUNT_TYPE_FINAL']->value; ?> " /><table width="100%" border="0" cellpadding="5" cellspacing="0" class="table table-nobordered popupTable"><thead><tr><th id="discount_div_title_final"><b><?php echo vtranslate('LBL_SET_DISCOUNT_FOR', $_smarty_tpl->tpl_vars['MODULE']->value); ?> :<?php echo $_smarty_tpl->tpl_vars['data']->value[$_smarty_tpl->tpl_vars['productTotal']->value]; ?> </b></th><th><button type="button" class="close closeDiv">x</button></th></tr></thead><tbody><tr><td><input type="radio" name="discount_final" class="finalDiscounts" data-discount-type="zero" <?php if ($_smarty_tpl->tpl_vars['DISCOUNT_TYPE_FINAL']->value == 'zero') { ?> checked<?php } ?> /> <?php echo vtranslate('LBL_ZERO_DISCOUNT', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </td><td class="lineOnTop"><!-- Make the discount value as zero --><input type="hidden" class="discountVal" value="0" /></td></tr><tr><td><input type="radio" name="discount_final" class="finalDiscounts" data-discount-type="percentage" <?php if ($_smarty_tpl->tpl_vars['DISCOUNT_TYPE_FINAL']->value == 'percentage') { ?> checked<?php } ?> /> % <?php echo vtranslate('LBL_OF_PRICE', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </td><td><span class="pull-right"> %</span><input type="text" data-validation-engine="validate[funcCall[Vtiger_PositiveNumber_Validator_Js.invokeValidation]]" id="discount_percentage_final" name="discount_percentage_final" value="<?php echo $_smarty_tpl->tpl_vars['FINAL']->value['discount_percentage_final']; ?> " class="discount_percentage_final smallInputBox pull-right discountVal <?php if ($_smarty_tpl->tpl_vars['DISCOUNT_TYPE_FINAL']->value != 'percentage') { ?> hide<?php } ?> " /></td></tr><tr><td><input type="radio" name="discount_final" class="finalDiscounts" data-discount-type="amount" <?php if ($_smarty_tpl->tpl_vars['DISCOUNT_TYPE_FINAL']->value == 'amount') { ?> checked<?php } ?> /> <?php echo vtranslate('LBL_DIRECT_PRICE_REDUCTION', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </td><td><input type="text" data-validation-engine="validate[funcCall[Vtiger_PositiveNumber_Validator_Js.invokeValidation]]" id="discount_amount_final" name="discount_amount_final" value="<?php echo $_smarty_tpl->tpl_vars['FINAL']->value['discount_amount_final']; ?> " class="smallInputBox pull-right discount_amount_final discountVal <?php if ($_smarty_tpl->tpl_vars['DISCOUNT_TYPE_FINAL']->value != 'amount') { ?> hide<?php } ?> " /></td></tr></tbody></table><div class="modal-footer lineItemPopupModalFooter modal-footer-padding"><div class=" pull-right cancelLinkContainer"><a class="cancelLink" type="reset" data-dismiss="modal"><?php echo vtranslate('LBL_CANCEL', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </a></div><button class="btn btn-success finalDiscountSave" type="button" name="lineItemActionSave"><strong><?php echo vtranslate('LBL_SAVE', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </strong></button></div></div><!-- End Popup Div --></td></tr><tr style="display:none;"><td width="83%"><span class="pull-right">(+) <b><?php echo vtranslate('LBL_SHIPPING_AND_HANDLING_CHARGES', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </b></span></td><td><span class="pull-right"><input id="shipping_handling_charge" name="shipping_handling_charge" data-validation-engine="validate[funcCall[Vtiger_PositiveNumber_Validator_Js.invokeValidation]]" type="text" class="lineItemInputBox" value="<?php if ($_smarty_tpl->tpl_vars['FINAL']->value['shipping_handling_charge']) { echo $_smarty_tpl->tpl_vars['FINAL']->value['shipping_handling_charge']; } else { ?> 0<?php } ?> " /></span></td></tr><tr style="display:none;"><td width="83%"><span class="pull-right"><b><?php echo vtranslate('LBL_PRE_TAX_TOTAL', $_smarty_tpl->tpl_vars['MODULE_NAME']->value); ?> </b></span></td><td><?php $_smarty_tpl->tpl_vars['PRE_TAX_TOTAL'] = new Smarty_variable($_smarty_tpl->tpl_vars['FINAL']->value['preTaxTotal'], null, 0); ?> <span class="pull-right" id="preTaxTotal"><?php if ($_smarty_tpl->tpl_vars['PRE_TAX_TOTAL']->value) { echo $_smarty_tpl->tpl_vars['PRE_TAX_TOTAL']->value; } else { ?> 0<?php } ?> </span><input type="hidden" id="pre_tax_total" name="pre_tax_total" value="<?php if ($_smarty_tpl->tpl_vars['PRE_TAX_TOTAL']->value) { echo $_smarty_tpl->tpl_vars['PRE_TAX_TOTAL']->value; } else { ?> 0<?php } ?> "/></td></tr><!-- Group Tax - starts --><tr style="display:none;" id="group_tax_row" valign="top" class="<?php if ($_smarty_tpl->tpl_vars['IS_INDIVIDUAL_TAX_TYPE']->value) { ?> hide<?php } ?> "><td width="83%"><span class="pull-right">(+) <b><a href="javascript:void(0)" id="finalTax"><?php echo vtranslate('LBL_TAX', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </a></b></span><!-- Pop Div For Group TAX --><div class="hide finalTaxUI validCheck" id="group_tax_div"><table width="100%" border="0" cellpadding="5" cellspacing="0" class="table table-nobordered popupTable"><tr><th id="group_tax_div_title" colspan="2" nowrap align="left" ><?php echo vtranslate('LBL_GROUP_TAX', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </th><th align="right"><button type="button" class="close closeDiv">x</button></th></tr><?php $_smarty_tpl->tpl_vars['tax_detail'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['tax_detail']->_loop = false; $_smarty_tpl->tpl_vars['loop_count'] = new Smarty_Variable(); $_from = $_smarty_tpl->tpl_vars['TAXES']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } $_smarty_tpl->tpl_vars['smarty']->value['foreach']['group_tax_loop']['iteration'] = 0; foreach ($_from as $_smarty_tpl->tpl_vars['tax_detail']->key => $_smarty_tpl->tpl_vars['tax_detail']->value) { $_smarty_tpl->tpl_vars['tax_detail']->_loop = true; $_smarty_tpl->tpl_vars['loop_count']->value = $_smarty_tpl->tpl_vars['tax_detail']->key; $_smarty_tpl->tpl_vars['smarty']->value['foreach']['group_tax_loop']['iteration']++; ?> <tr><td align="left" class="lineOnTop"><input type="text" size="5" data-validation-engine="validate[funcCall[Vtiger_PositiveNumber_Validator_Js.invokeValidation]]" name="<?php echo $_smarty_tpl->tpl_vars['tax_detail']->value['taxname']; ?> _group_percentage" id="group_tax_percentage<?php echo $_smarty_tpl->getVariable('smarty')->value['foreach']['group_tax_loop']['iteration']; ?> " value="<?php echo $_smarty_tpl->tpl_vars['tax_detail']->value['percentage']; ?> " class="smallInputBox groupTaxPercentage" /> %</td><td align="center" class="lineOnTop"><div class="textOverflowEllipsis"><?php echo $_smarty_tpl->tpl_vars['tax_detail']->value['taxlabel']; ?> </div></td><td align="right" class="lineOnTop"><input type="text" size="6" name="<?php echo $_smarty_tpl->tpl_vars['tax_detail']->value['taxname']; ?> _group_amount" id="group_tax_amount<?php echo $_smarty_tpl->getVariable('smarty')->value['foreach']['group_tax_loop']['iteration']; ?> " style="cursor:pointer;" value="<?php echo $_smarty_tpl->tpl_vars['tax_detail']->value['amount']; ?> " readonly class="cursorPointer smallInputBox groupTaxTotal" /></td></tr><?php } ?> <input type="hidden" id="group_tax_count" value="<?php echo $_smarty_tpl->getVariable('smarty')->value['foreach']['group_tax_loop']['iteration']; ?> " /></table><div class="modal-footer lineItemPopupModalFooter modal-footer-padding"><div class=" pull-right cancelLinkContainer"><a class="cancelLink" type="reset" data-dismiss="modal"><?php echo vtranslate('LBL_CANCEL', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </a></div><button class="btn btn-success" type="button" name="lineItemActionSave"><strong><?php echo vtranslate('LBL_SAVE', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </strong></button></div></div><!-- End Popup Div Group Tax --></td><td><span id="tax_final" class="pull-right tax_final"><?php if ($_smarty_tpl->tpl_vars['FINAL']->value['tax_totalamount']) { echo $_smarty_tpl->tpl_vars['FINAL']->value['tax_totalamount']; } else { ?> 0<?php } ?> </span></td></tr><!-- Group Tax - ends --><tr style="display:none;"><td width="83%"><span class="pull-right">(+) <b><a href="javascript:void(0)" id="shippingHandlingTax"><?php echo vtranslate('LBL_TAX_FOR_SHIPPING_AND_HANDLING', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </a></b></span><!-- Pop Div For Shipping and Handling TAX --><div class="hide validCheck" id="shipping_handling_div"><table class="table table-nobordered popupTable"><thead><tr><th id="sh_tax_div_title" colspan="2" nowrap align="left" ><?php echo vtranslate('LBL_SET_SHIPPING_AND_HANDLING_TAXES_FOR', $_smarty_tpl->tpl_vars['MODULE']->value); ?> : <span id="shAmountForTax" ><?php if ($_smarty_tpl->tpl_vars['FINAL']->value['shipping_handling_charge']) { echo $_smarty_tpl->tpl_vars['FINAL']->value['shipping_handling_charge']; } else { ?> 0<?php } ?> </span></th><th align="right"><button type="button" class="close closeDiv">x</button></th></tr></thead><tbody><?php $_smarty_tpl->tpl_vars['tax_detail'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['tax_detail']->_loop = false; $_smarty_tpl->tpl_vars['loop_count'] = new Smarty_Variable(); $_from = $_smarty_tpl->tpl_vars['SHIPPING_TAXES']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } $_smarty_tpl->tpl_vars['smarty']->value['foreach']['sh_loop']['iteration'] = 0; foreach ($_from as $_smarty_tpl->tpl_vars['tax_detail']->key => $_smarty_tpl->tpl_vars['tax_detail']->value) { $_smarty_tpl->tpl_vars['tax_detail']->_loop = true; $_smarty_tpl->tpl_vars['loop_count']->value = $_smarty_tpl->tpl_vars['tax_detail']->key; $_smarty_tpl->tpl_vars['smarty']->value['foreach']['sh_loop']['iteration']++; ?> <tr><td><div class="textOverflowEllipsis"><?php echo vtranslate($_smarty_tpl->tpl_vars['tax_detail']->value['taxlabel'], $_smarty_tpl->tpl_vars['MODULE']->value); ?> </div></td><td><input type="text" data-validation-engine="validate[funcCall[Vtiger_PositiveNumber_Validator_Js.invokeValidation]]" name="<?php echo $_smarty_tpl->tpl_vars['tax_detail']->value['taxname']; ?> _sh_percent" id="sh_tax_percentage<?php echo $_smarty_tpl->getVariable('smarty')->value['foreach']['sh_loop']['iteration']; ?> " value="<?php echo $_smarty_tpl->tpl_vars['tax_detail']->value['percentage']; ?> " class="smallInputBox shippingTaxPercentage" /> %</td><td><input type="text" name="<?php echo $_smarty_tpl->tpl_vars['tax_detail']->value['taxname']; ?> _sh_amount" id="sh_tax_amount<?php echo $_smarty_tpl->getVariable('smarty')->value['foreach']['sh_loop']['iteration']; ?> " class="cursorPointer smallInputBox shippingTaxTotal pull-right" value="<?php echo $_smarty_tpl->tpl_vars['tax_detail']->value['amount']; ?> " readonly /></td></tr><?php } ?> <input type="hidden" id="sh_tax_count" value="<?php echo $_smarty_tpl->getVariable('smarty')->value['foreach']['sh_loop']['iteration']; ?> " /></tbody></table><div class="modal-footer lineItemPopupModalFooter modal-footer-padding"><div class=" pull-right cancelLinkContainer"><a class="cancelLink" type="reset" data-dismiss="modal"><?php echo vtranslate('LBL_CANCEL', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </a></div><button class="btn btn-success finalTaxSave" type="button" name="lineItemActionSave"><strong><?php echo vtranslate('LBL_SAVE', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </strong></button></div></div><!-- End Popup Div for Shipping and Handling TAX --></td><td><span class="pull-right shipping_handling_tax" id="shipping_handling_tax"><?php if ($_smarty_tpl->tpl_vars['FINAL']->value['shtax_totalamount']) { echo $_smarty_tpl->tpl_vars['FINAL']->value['shtax_totalamount']; } else { ?> 0<?php } ?> </span></td></tr><tr valign="top"><td width="83%" ><div class="pull-right"><b><?php echo vtranslate('LBL_ADJUSTMENT', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </b><div class="radio pull-right"><input type="radio" name="adjustmentType" option value="-" <?php if ($_smarty_tpl->tpl_vars['FINAL']->value['adjustment'] < 0) { ?> checked<?php } ?> ><?php echo vtranslate('LBL_DEDUCT', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </div><div class="radio pull-right"><input type="radio" name="adjustmentType" option value="+" <?php if ($_smarty_tpl->tpl_vars['FINAL']->value['adjustment'] >= 0) { ?> checked<?php } ?> ><?php echo vtranslate('LBL_ADD', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </div></div></td><td><span class="pull-right"><input id="adjustment" name="adjustment" type="text" data-validation-engine="validate[funcCall[Vtiger_PositiveNumber_Validator_Js.invokeValidation]]" class="lineItemInputBox" value="<?php if ($_smarty_tpl->tpl_vars['FINAL']->value['adjustment'] < 0) { echo abs($_smarty_tpl->tpl_vars['FINAL']->value['adjustment']); } elseif ($_smarty_tpl->tpl_vars['FINAL']->value['adjustment']) { echo $_smarty_tpl->tpl_vars['FINAL']->value['adjustment']; } else { ?> 0<?php } ?> "></span></td></tr><tr valign="top"><td width="83%"><span class="pull-right"><b><?php echo vtranslate('LBL_GRAND_TOTAL', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </b></span></td><td><span id="grandTotal" name="grandTotal" class="pull-right grandTotal"><?php echo $_smarty_tpl->tpl_vars['FINAL']->value['grandTotal']; ?> </span></td></tr><?php if ($_smarty_tpl->tpl_vars['MODULE']->value == 'Invoice' || $_smarty_tpl->tpl_vars['MODULE']->value == 'PurchaseOrder') { ?> <tr valign="top"><td width="83%" ><div class="pull-right"><?php if ($_smarty_tpl->tpl_vars['MODULE']->value == 'Invoice') { ?> <b><?php echo vtranslate('LBL_RECEIVED', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </b><?php } else { ?> <b><?php echo vtranslate('LBL_PAID', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </b><?php } ?> </div></td><td><?php if ($_smarty_tpl->tpl_vars['MODULE']->value == 'Invoice') { ?> <span class="pull-right"><input id="received" name="received" type="text" class="lineItemInputBox" value="<?php if ($_smarty_tpl->tpl_vars['RECORD']->value->getDisplayValue('received') && !$_smarty_tpl->tpl_vars['IS_DUPLICATE']->value) { echo $_smarty_tpl->tpl_vars['RECORD']->value->getDisplayValue('received'); } else { ?> 0<?php } ?> "></span><?php } else { ?> <span class="pull-right"><input id="paid" name="paid" type="text" class="lineItemInputBox" value="<?php if ($_smarty_tpl->tpl_vars['RECORD']->value->getDisplayValue('paid') && !$_smarty_tpl->tpl_vars['IS_DUPLICATE']->value) { echo $_smarty_tpl->tpl_vars['RECORD']->value->getDisplayValue('paid'); } else { ?> 0<?php } ?> "></span><?php } ?> </td></tr><tr valign="top"><td width="83%" ><div class="pull-right"><b><?php echo vtranslate('LBL_BALANCE', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </b></div></td><td><span class="pull-right"><input id="balance" name="balance" type="text" class="lineItemInputBox" value="<?php if ($_smarty_tpl->tpl_vars['RECORD']->value->getDisplayValue('balance') && !$_smarty_tpl->tpl_vars['IS_DUPLICATE']->value) { echo $_smarty_tpl->tpl_vars['RECORD']->value->getDisplayValue('balance'); } else { ?> 0<?php } ?> " readonly></span></td></tr><?php } ?> </table><br><input type="hidden" name="totalProductCount" id="totalProductCount" value="<?php echo $_smarty_tpl->tpl_vars['row_no']->value; ?> " /><input type="hidden" name="subtotal" id="subtotal" value="" /><input type="hidden" name="total" id="total" value="" /> <?php }
/** Function to get the Currency name from the vtiger_currency_info * @param $currencyid -- vtiger_currencyid:: Type integer * @returns $currencyname -- Currency Name:: Type varchar * */ function getCurrencyName($currencyid, $show_symbol = true) { global $log; $log->debug("Entering getCurrencyName(" . $currencyid . ") method ..."); // Look at cache first $currencyinfo = VTCacheUtils::lookupCurrencyInfo($currencyid); if ($currencyinfo === false) { global $adb; $sql1 = "select * from vtiger_currency_info where id= ?"; $result = $adb->pquery($sql1, array($currencyid)); $resultinfo = $adb->fetch_array($result); // Update cache VTCacheUtils::updateCurrencyInfo($currencyid, $resultinfo['currency_name'], $resultinfo['currency_code'], $resultinfo['currency_symbol'], $resultinfo['conversion_rate']); // Re-look at the cache now $currencyinfo = VTCacheUtils::lookupCurrencyInfo($currencyid); } $currencyname = $currencyinfo['name']; $curr_symbol = $currencyinfo['symbol']; $log->debug("Exiting getCurrencyName method ..."); if ($show_symbol) { return getTranslatedCurrencyString($currencyname) . ' : ' . $curr_symbol; } else { return $currencyname; } // NOTE: Without symbol the value could be used for filtering/lookup hence avoiding the translation }
function content_5674f3567fadf($_smarty_tpl) { ?> <div id="currency_class" class="multiCurrencyEditUI modelContainer"><div class="modal-header"><button data-dismiss="modal" class="floatRight close" type="button" title="<?php echo vtranslate('LBL_CLOSE'); ?> ">x</button><h3 id="massEditHeader"><?php echo vtranslate('LBL_PRICES', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </h3></div><div class="multiCurrencyContainer"><div class="currencyContent"><div class="modal-body"><table width="100%" border="0" cellpadding="5" cellspacing="0" class="table table-bordered"><tr class="detailedViewHeader"><td><b><?php echo vtranslate('LBL_CURRENCY', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </b></td><td><b><?php echo vtranslate('LBL_PRICE', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </b></td><td><b><?php echo vtranslate('LBL_CONVERSION_RATE', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </b></td><td><b><?php echo vtranslate('LBL_RESET_PRICE', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </b></td><td><b><?php echo vtranslate('LBL_BASE_CURRENCY', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </b></td></tr><?php $_smarty_tpl->tpl_vars['price'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['price']->_loop = false; $_smarty_tpl->tpl_vars['count'] = new Smarty_Variable(); $_from = $_smarty_tpl->tpl_vars['PRICE_DETAILS']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['price']->key => $_smarty_tpl->tpl_vars['price']->value) { $_smarty_tpl->tpl_vars['price']->_loop = true; $_smarty_tpl->tpl_vars['count']->value = $_smarty_tpl->tpl_vars['price']->key; ?> <tr data-currency-id=<?php echo $_smarty_tpl->tpl_vars['price']->value['curname']; ?> ><?php if ($_smarty_tpl->tpl_vars['price']->value['check_value'] == 1 || $_smarty_tpl->tpl_vars['price']->value['is_basecurrency'] == 1) { $_smarty_tpl->tpl_vars['check_value'] = new Smarty_variable("checked", null, 0); $_smarty_tpl->tpl_vars['disable_value'] = new Smarty_variable('', null, 0); } else { $_smarty_tpl->tpl_vars['check_value'] = new Smarty_variable('', null, 0); $_smarty_tpl->tpl_vars['disable_value'] = new Smarty_variable("disabled=true", null, 0); } if ($_smarty_tpl->tpl_vars['price']->value['is_basecurrency'] == 1) { $_smarty_tpl->tpl_vars['base_cur_check'] = new Smarty_variable("checked", null, 0); } else { $_smarty_tpl->tpl_vars['base_cur_check'] = new Smarty_variable('', null, 0); } ?> <td><span class="row-fluid"><span class="span8 alignBottom"><span class="pull-left"><?php echo getTranslatedCurrencyString($_smarty_tpl->tpl_vars['price']->value['currencylabel']); ?> (<?php echo $_smarty_tpl->tpl_vars['price']->value['currencysymbol']; ?> )</span></span><span class="span2"><input type="checkbox" name="cur_<?php echo $_smarty_tpl->tpl_vars['price']->value['curid']; ?> _check" id="cur_<?php echo $_smarty_tpl->tpl_vars['price']->value['curid']; ?> _check" class="small pull-right enableCurrency" <?php echo $_smarty_tpl->tpl_vars['check_value']->value; ?> ></span></span></td><td><div class="row-fluid"><input <?php echo $_smarty_tpl->tpl_vars['disable_value']->value; ?> type="text" size="10" class="span9 convertedPrice" name="<?php echo $_smarty_tpl->tpl_vars['price']->value['curname']; ?> " id="<?php echo $_smarty_tpl->tpl_vars['price']->value['curname']; ?> " value="<?php echo $_smarty_tpl->tpl_vars['price']->value['curvalue']; ?> " data-validation-engine="validate[funcCall[Vtiger_Currency_Validator_Js.invokeValidation]]" data-decimal-seperator='<?php echo $_smarty_tpl->tpl_vars['USER_MODEL']->value->get('currency_decimal_separator'); ?> ' data-group-seperator='<?php echo $_smarty_tpl->tpl_vars['USER_MODEL']->value->get('currency_grouping_separator'); ?> ' /></div></td><td><div class="row-fluid"><input readonly="" type="text" size="10" class="span9 conversionRate" name="cur_conv_rate<?php echo $_smarty_tpl->tpl_vars['price']->value['curid']; ?> " value="<?php echo $_smarty_tpl->tpl_vars['price']->value['conversionrate']; ?> "></div></td><td><div class="row-fluid"><button <?php echo $_smarty_tpl->tpl_vars['disable_value']->value; ?> type="button" class="btn currencyReset resetButton" id="cur_reset<?php echo $_smarty_tpl->tpl_vars['price']->value['curid']; ?> " value="<?php echo vtranslate('LBL_RESET', $_smarty_tpl->tpl_vars['MODULE']->value); ?> "><?php echo vtranslate('LBL_RESET', $_smarty_tpl->tpl_vars['MODULE']->value); ?> </button></div></td><td><div class="row-fluid textAlignCenter"><input <?php echo $_smarty_tpl->tpl_vars['disable_value']->value; ?> type="radio" class="baseCurrency" id="base_currency<?php echo $_smarty_tpl->tpl_vars['price']->value['curid']; ?> " name="base_currency_input" value="<?php echo $_smarty_tpl->tpl_vars['price']->value['curname']; ?> " <?php echo $_smarty_tpl->tpl_vars['base_cur_check']->value; ?> /></div></td></tr><?php } ?> </table></div></div><?php echo $_smarty_tpl->getSubTemplate(vtemplate_path('ModalFooter.tpl', $_smarty_tpl->tpl_vars['MODULE']->value), $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0); ?> </div></div><?php }
<input type="hidden" value="<?php echo $this->_tpl_vars['INV_CURRENCY_ID']; ?> " id="prev_selected_currency_id" /> <b><?php echo $this->_tpl_vars['APP']['LBL_CURRENCY']; ?> </b> <select class="small" id="inventory_currency" name="inventory_currency" onchange="updatePrices();"> <?php $_from = $this->_tpl_vars['CURRENCIES_LIST']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): foreach ($_from as $this->_tpl_vars['count'] => $this->_tpl_vars['currency_details']): ?> <?php if ($this->_tpl_vars['currency_details']['curid'] == $this->_tpl_vars['INV_CURRENCY_ID']): ?> <?php $this->assign('currency_selected', 'selected'); ?> <?php else: ?> <?php $this->assign('currency_selected', ""); ?> <?php endif; ?> <OPTION value="<?php echo $this->_tpl_vars['currency_details']['curid']; ?> " <?php echo $this->_tpl_vars['currency_selected']; ?> ><?php echo getTranslatedCurrencyString($this->_tpl_vars['currency_details']['currencylabel']); ?> (<?php echo $this->_tpl_vars['currency_details']['currencysymbol']; ?> )</OPTION> <?php endforeach; endif; unset($_from); ?> </select> </td> <td class="dvInnerHeader" align="center" colspan="2"> <b><?php echo $this->_tpl_vars['APP']['LBL_TAX_MODE']; ?> </b> <?php if ($this->_tpl_vars['ASSOCIATEDPRODUCTS']['1']['final_details']['taxtype'] == 'group'): ?> <?php $this->assign('group_selected', 'selected'); ?> <?php else: ?> <?php $this->assign('individual_selected', 'selected'); ?> <?php endif; ?>
<?php $_from = $this->_tpl_vars['arr']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } if (count($_from)) { foreach ($_from as $this->_tpl_vars['sel_value'] => $this->_tpl_vars['value']) { ?> <option value="<?php echo $this->_tpl_vars['uivalueid']; ?> " <?php echo $this->_tpl_vars['value']; ?> ><?php echo getTranslatedCurrencyString($this->_tpl_vars['sel_value']); ?> </option> <!-- code added to pass Currency field value, if Disabled for nonadmin --> <?php if ($this->_tpl_vars['value'] == 'selected' && $this->_tpl_vars['secondvalue'] != 1) { ?> <?php $this->assign('curr_stat', $this->_tpl_vars['uivalueid']); ?> <?php } ?> <!--code ends --> <?php }
$smarty = new vtigerCRM_Smarty(); $parenttab = getParentTab(); $sql = "select * from vtiger_currency_info where deleted=0"; $result = $adb->pquery($sql, array()); $temprow = $adb->fetch_array($result); $cnt = 1; $currency = array(); do { $currency_element = array(); $currency_element['name'] = $temprow["currency_name"]; $currency_element['code'] = $temprow["currency_code"]; $currency_element['symbol'] = $temprow["currency_symbol"]; $currency_element['crate'] = $temprow["conversion_rate"]; $currency_element['status'] = $temprow["currency_status"]; if ($temprow["defaultid"] != '-11') { $currency_element['name'] = '<a href=index.php?module=Settings&action=CurrencyEditView&parenttab=' . $parenttab . '&record=' . $temprow["id"] . '&detailview=detail_view>' . getTranslatedCurrencyString($temprow["currency_name"]) . '</a>'; $currency_element['tool'] = '<a href=index.php?module=Settings&action=CurrencyEditView&parenttab=' . $parenttab . '&record=' . $temprow["id"] . '><img src="' . vtiger_imageurl('editfield.gif', $theme) . '" border="0" alt="' . $app_strings['LBL_EDIT_BUTTON_LABEL'] . '" title="' . $app_strings['LBL_EDIT_BUTTON_LABEL'] . '"/></a> | <img style="cursor:pointer;" onClick="fnvshobj(this,\'currencydiv\');deleteCurrency(\'' . $temprow['id'] . '\');" src="' . vtiger_imageurl('delete.gif', $theme) . '" border="0" alt="' . $app_strings['LBL_DELETE_BUTTON_LABEL'] . '" title="' . $app_strings['LBL_DELETE_BUTTON_LABEL'] . '"/>'; } else { $currency_element['tool'] = ''; } $currency[] = $currency_element; $cnt++; } while ($temprow = $adb->fetch_array($result)); $smarty->assign("PARENTTAB", $parenttab); $smarty->assign("THEME", $theme); $smarty->assign("IMAGE_PATH", $image_path); $smarty->assign("MOD", $mod_strings); $smarty->assign("CURRENCY_LIST", $currency); if ($_REQUEST['ajax'] != '') { $smarty->display("CurrencyListViewEntries.tpl"); } else {
$this->_foreach['currlist'] = array('total' => count($_from), 'iteration' => 0); if ($this->_foreach['currlist']['total'] > 0) { foreach ($_from as $this->_tpl_vars['id'] => $this->_tpl_vars['currencyvalues']) { $this->_foreach['currlist']['iteration']++; ?> <tr> <td nowrap class="listTableRow small" valign="top"><?php echo $this->_foreach['currlist']['iteration']; ?> </td> <td nowrap class="listTableRow small" valign="top"><?php echo $this->_tpl_vars['currencyvalues']['tool']; ?> </td> <td nowrap class="listTableRow small" valign="top"><b><?php echo getTranslatedCurrencyString($this->_tpl_vars['currencyvalues']['name']); ?> </b></td> <td nowrap class="listTableRow small" valign="top"><?php echo $this->_tpl_vars['currencyvalues']['code']; ?> </td> <td nowrap class="listTableRow small" valign="top"><?php echo $this->_tpl_vars['currencyvalues']['symbol']; ?> </td> <td nowrap class="listTableRow small" valign="top"><?php echo $this->_tpl_vars['currencyvalues']['crate']; ?> </td> <?php
private function x0d() { global $x0b, $x0c, $x0d, $x0e, $x0f, $x10, $x11, $x12, $x13, $x14, $x15, $x16, $x17, $x18, $x19, $x1a, $x1b, $x1c, $x1d, $x1e, $x1f, $x20, $x21, $x22, $x23, $x24, $x25, $x26; if ($this->module == "Quotes" || $this->module == "Invoice" || $this->module == "SalesOrder" || $this->module == "PurchaseOrder") { $this->replacements["\$" . "SUBTOTAL\$"] = $this->x1e($this->focus->column_fields["hdnSubTotal"]); $this->replacements["\$" . "TOTAL\$"] = $this->x1e($this->focus->column_fields["hdnGrandTotal"]); $currencytype = $this->x1c(); $currencytype["currency_symbol"] = $x1e("€", "€", $currencytype["currency_symbol"]); $currencytype["currency_symbol"] = $x1e("£", "£", $currencytype["currency_symbol"]); $this->replacements["\$" . "CURRENCYNAME\$"] = getTranslatedCurrencyString($currencytype["currency_name"]); $this->replacements["\$" . "CURRENCYSYMBOL\$"] = $currencytype["currency_symbol"]; $this->replacements["\$" . "CURRENCYCODE\$"] = $currencytype["currency_code"]; $this->replacements["\$" . "ADJUSTMENT\$"] = $this->x1e($this->focus->column_fields["txtAdjustment"]); $Products = $this->x15(); $this->replacements["\$" . "TOTALWITHOUTVAT\$"] = $Products["TOTAL"]["TOTALWITHOUTVAT"]; $this->replacements["\$" . "VAT\$"] = $Products["TOTAL"]["TAXTOTAL"]; $this->replacements["\$" . "VATPERCENT\$"] = $Products["TOTAL"]["TAXTOTALPERCENT"]; if ($x0f($Products["TOTAL"]["VATBLOCK"]) > 0) { $vattable = "<table border='1' style=\"border-collapse:collapse;\" cellpadding=\"3\">"; $vattable .= "<tr>\r\n\t <td nowrap align='center'>" . $this->app_strings["Name"] . "</td>\r\r\n\t\t\t\t\t\t\t<td nowrap align='center'>" . $this->mod_strings["LBL_VATBLOCK_VAT_PERCENT"] . "</td>\r\r\n\t <td nowrap align='center'>" . $this->mod_strings["LBL_VATBLOCK_SUM"] . " (" . $currencytype["currency_symbol"] . ")" . "</td>\r\n\t <td nowrap align='center'>" . $this->mod_strings["LBL_VATBLOCK_VAT_VALUE"] . " (" . $currencytype["currency_symbol"] . ")" . "</td>\r\n\t </tr>"; foreach ($Products["TOTAL"]["VATBLOCK"] as $keyW => $valueW) { if ($valueW["netto"] != 0) { $vattable .= "<tr>\r\n <td nowrap align='left' width='20%'>" . $valueW["label"] . "</td>\r\n\n \t\t\t\t<td nowrap align='right' width='25%'>" . $this->x1e($valueW["value"]) . " %</td>\r\r\n <td nowrap align='right' width='30%'>" . $this->x1e($valueW["netto"]) . "</td>\r\n\n <td nowrap align='right' width='25%'>" . $this->x1e($valueW["vat"]) . "</td>\r\n </tr>"; } } $vattable .= "</table>"; } else { $vattable = ""; } $this->replacements["\$" . "VATBLOCK\$"] = $vattable; $this->replacements["\$" . "TOTALWITHVAT\$"] = $Products["TOTAL"]["TOTALWITHVAT"]; $this->replacements["\$" . "SHTAXAMOUNT\$"] = $Products["TOTAL"]["SHTAXAMOUNT"]; $this->replacements["\$" . "SHTAXTOTAL\$"] = $Products["TOTAL"]["SHTAXTOTAL"]; $this->replacements["\$" . "TOTALDISCOUNT\$"] = $Products["TOTAL"]["FINALDISCOUNT"]; $this->replacements["\$" . "TOTALDISCOUNTPERCENT\$"] = $Products["TOTAL"]["FINALDISCOUNTPERCENT"]; $this->replacements["\$" . "TOTALAFTERDISCOUNT\$"] = $Products["TOTAL"]["TOTALAFTERDISCOUNT"]; $this->x12(); $var_array = array(); if ($x23($this->content, "#PRODUCTBLOC_START#") !== false && $x23($this->content, "#PRODUCTBLOC_END#") !== false) { $tableTag = $this->x0c(); $breaklines_array = $this->x16(); $breaklines = $breaklines_array["products"]; $show_header = $breaklines_array["show_header"]; $show_subtotal = $breaklines_array["show_subtotal"]; $breakline_type = ""; if ($x0f($breaklines) > 0) { if ($tableTag !== false) { $breakline_type = "</table>" . $this->pagebreak . $tableTag["tag"]; if ($show_header == 1) { $breakline_type .= $tableTag["header"]; } if ($show_subtotal == 1) { $breakline_type = $tableTag["subtotal"] . $breakline_type; } else { $breakline_type = $tableTag["footer"] . $breakline_type; } } else { $breakline_type = $this->pagebreak; } } $ExplodedPdf = array(); $Exploded = $x11("#PRODUCTBLOC_START#", $this->content); $ExplodedPdf[] = $Exploded[0]; for ($iterator = 1; $iterator < $x0f($Exploded); $iterator++) { $SubExploded = $x11("#PRODUCTBLOC_END#", $Exploded[$iterator]); foreach ($SubExploded as $part) { $ExplodedPdf[] = $part; } $highestpartid = $iterator * 2 - 1; $ProductParts[$highestpartid] = $ExplodedPdf[$highestpartid]; $ExplodedPdf[$highestpartid] = ''; } if ($Products["P"]) { foreach ($Products["P"] as $Product_i => $Product_Details) { foreach ($ProductParts as $productpartid => $productparttext) { $breakline = ""; if ($breakline_type != "" && isset($breaklines[$Product_Details["SERVICES_RECORD_ID"] . "_" . $Product_Details["PRODUCTSEQUENCE"]]) || isset($breaklines[$Product_Details["PRODUCTS_RECORD_ID"] . "_" . $Product_Details["PRODUCTSEQUENCE"]])) { $breakline = $breakline_type; } $productparttext .= $breakline; foreach ($Product_Details as $coll => $value) { $productparttext = $x1e("\$" . $x22($coll) . "\$", $value, $productparttext); } $ExplodedPdf[$productpartid] .= $productparttext; } } } $this->content = $x15('', $ExplodedPdf); } } }
/** This function returns a HTML output of associated vtiger_products for a given entity (Quotes,Invoice,Sales order or Purchase order) * Param $module - module name * Param $focus - module object * Return type string */ function getDetailAssociatedProducts($module, $focus) { global $log; $log->debug("Entering getDetailAssociatedProducts(" . $module . "," . get_class($focus) . ") method ..."); global $adb, $default_charset; global $mod_strings; global $theme; global $log; global $app_strings, $current_user, $current_language; $theme_path = "themes/" . $theme . "/"; $image_path = $theme_path . "images/"; //crm-now: added to select comma or dot as numberformat //European Format if ($current_language == 'en_us') { //US Format $decimal_precision = 2; $decimals_separator = '.'; $thousands_separator = ','; } else { //European Format $decimal_precision = 2; $decimals_separator = ','; $thousands_separator = '.'; } if ($module != 'PurchaseOrder') { $colspan = '2'; } else { $colspan = '1'; } //Get the taxtype of this entity $taxtype = getInventoryTaxType($module, $focus->id); $currencytype = getInventoryCurrencyInfo($module, $focus->id); $output = ''; //Header Rows $output .= ' <table width="100%" border="0" align="center" cellpadding="5" cellspacing="0" class="crmTable" id="proTab"> <tr valign="top"> <td colspan="' . $colspan . '" class="dvInnerHeader"><b>' . $app_strings['LBL_ITEM_DETAILS'] . '</b></td> <td class="dvInnerHeader" align="center" colspan="2"><b>' . $app_strings['LBL_CURRENCY'] . ' : </b>' . getTranslatedCurrencyString($currencytype['currency_name']) . ' (' . $currencytype['currency_symbol'] . ') </td> <td class="dvInnerHeader" align="center" colspan="2"><b>' . $app_strings['LBL_TAX_MODE'] . ' : </b>' . $app_strings[$taxtype] . ' </td> </tr> <tr valign="top"> <td width=40% class="lvtCol"><font color="red">*</font> <b>' . $app_strings['LBL_ITEM_NAME'] . '</b> </td>'; //Add Quantity in Stock column for SO, Quotes and Invoice if ($module == 'Quotes' || $module == 'SalesOrder' || $module == 'Invoice') { $output .= '<td width=10% class="lvtCol"><b>' . $app_strings['LBL_QTY_IN_STOCK'] . '</b></td>'; } $output .= ' <td width=10% class="lvtCol"><b>' . $app_strings['LBL_QTY'] . '</b></td> <td width=10% class="lvtCol" align="right"><b>' . $app_strings['LBL_LIST_PRICE'] . '</b></td> <td width=12% nowrap class="lvtCol" align="right"><b>' . $app_strings['LBL_TOTAL'] . '</b></td> <td width=13% valign="top" class="lvtCol" align="right"><b>' . $app_strings['LBL_NET_PRICE'] . '</b></td> </tr> '; // DG 15 Aug 2006 // Add "ORDER BY sequence_no" to retain add order on all inventoryproductrel items if ($module == 'Quotes' || $module == 'PurchaseOrder' || $module == 'SalesOrder' || $module == 'Invoice') { $query = "select case when vtiger_products.productid != '' then vtiger_products.productname else vtiger_service.servicename end as productname," . " case when vtiger_products.productid != '' then 'Products' else 'Services' end as entitytype," . " case when vtiger_products.productid != '' then vtiger_products.unit_price else vtiger_service.unit_price end as unit_price," . " case when vtiger_products.productid != '' then vtiger_products.productcode else 'NA' end as productcode," . " case when vtiger_products.productid != '' then vtiger_products.qtyinstock else 'NA' end as qtyinstock, vtiger_inventoryproductrel.* " . " from vtiger_inventoryproductrel" . " left join vtiger_products on vtiger_products.productid=vtiger_inventoryproductrel.productid " . " left join vtiger_service on vtiger_service.serviceid=vtiger_inventoryproductrel.productid " . " where id=? ORDER BY sequence_no"; } $result = $adb->pquery($query, array($focus->id)); $num_rows = $adb->num_rows($result); $netTotal = '0.00'; for ($i = 1; $i <= $num_rows; $i++) { $sub_prod_query = $adb->pquery("SELECT productid from vtiger_inventorysubproductrel WHERE id=? AND sequence_no=?", array($focus->id, $i)); $subprodname_str = ''; if ($adb->num_rows($sub_prod_query) > 0) { for ($j = 0; $j < $adb->num_rows($sub_prod_query); $j++) { $sprod_id = $adb->query_result($sub_prod_query, $j, 'productid'); $sprod_name = getProductName($sprod_id); $str_sep = ""; if ($j > 0) { $str_sep = ":"; } $subprodname_str .= $str_sep . " - " . $sprod_name; } } $subprodname_str = str_replace(":", "<br>", $subprodname_str); $productid = $adb->query_result($result, $i - 1, 'productid'); $entitytype = $adb->query_result($result, $i - 1, 'entitytype'); $productname = $adb->query_result($result, $i - 1, 'productname'); //crm-now added to display product code and description $productcode = $adb->query_result($result, $i - 1, 'productcode'); //html to utf8 conversion (necessary because stored at inventoryproductrel table) $productdescription = nl2br($adb->query_result($result, $i - 1, 'description')); $productdescription = html_entity_decode($productdescription, ENT_QUOTES, $default_charset); $comment = nl2br(from_html($adb->query_result($result, $i - 1, 'comment'))); if ($subprodname_str != '') { $productname .= "<br/><span style='color:#C0C0C0;font-style:italic;'>" . $subprodname_str . "</span>"; } //$comment=$adb->query_result($result,$i-1,'comment'); $qtyinstock = $adb->query_result($result, $i - 1, 'qtyinstock'); $qty = $adb->query_result($result, $i - 1, 'quantity'); $unitprice = $adb->query_result($result, $i - 1, 'unit_price'); $listprice = $adb->query_result($result, $i - 1, 'listprice'); $listpriceformated = number_format($listprice, $decimal_precision, $decimals_separator, $thousands_separator); $total = $qty * $listprice; $totalformated = number_format($total, $decimal_precision, $decimals_separator, $thousands_separator); //Product wise Discount calculation - starts $discount_percent = $adb->query_result($result, $i - 1, 'discount_percent'); $discount_amount = $adb->query_result($result, $i - 1, 'discount_amount'); $totalAfterDiscount = $total; $totalAfterDiscountformated = number_format($total, $decimal_precision, $decimals_separator, $thousands_separator); $productDiscount = '0.00'; $productDiscountformated = number_format($productDiscount, $decimal_precision, $decimals_separator, $thousands_separator); if ($discount_percent != 'NULL' && $discount_percent != '') { $productDiscount = $total * $discount_percent / 100; $productDiscountformated = number_format($productDiscount, $decimal_precision, $decimals_separator, $thousands_separator); $totalAfterDiscount = $total - $productDiscount; $totalAfterDiscountformated = number_format($totalAfterDiscount, $decimal_precision, $decimals_separator, $thousands_separator); //if discount is percent then show the percentage $discount_info_message = "{$discount_percent} % " . $app_strings['of_string'] . " {$total} = {$productDiscountformated}"; } elseif ($discount_amount != 'NULL' && $discount_amount != '') { $productDiscount = $discount_amount; $productDiscountformated = number_format($productDiscount, $decimal_precision, $decimals_separator, $thousands_separator); $totalAfterDiscount = $total - $productDiscount; $totalAfterDiscountformated = number_format($totalAfterDiscount, $decimal_precision, $decimals_separator, $thousands_separator); $discount_info_message = $app_strings['LBL_DIRECT_AMOUNT_DISCOUNT'] . " = {$productDiscountformated}"; } else { $discount_info_message = $app_strings['LBL_NO_DISCOUNT_FOR_THIS_LINE_ITEM']; } //Product wise Discount calculation - ends $netprice = $totalAfterDiscount; //Calculate the individual tax if taxtype is individual if ($taxtype == 'individual') { $taxtotal = '0.00'; $tax_info_message = $app_strings['LBL_TOTAL_AFTER_DISCOUNT'] . " = {$totalAfterDiscountformated} \\n"; $tax_details = getTaxDetailsForProduct($productid, 'all'); for ($tax_count = 0; $tax_count < count($tax_details); $tax_count++) { $tax_name = $tax_details[$tax_count]['taxname']; $tax_label = $tax_details[$tax_count]['taxlabel']; $tax_value = getInventoryProductTaxValue($focus->id, $productid, $tax_name); $individual_taxamount = $totalAfterDiscount * $tax_value / 100; $individual_taxamountformated = number_format(round($individual_taxamount, 2), $decimal_precision, $decimals_separator, $thousands_separator); $taxtotal = $taxtotal + $individual_taxamount; $taxtotalformated = number_format(round($taxtotal, 2), $decimal_precision, $decimals_separator, $thousands_separator); $tax_info_message .= "{$tax_label} : {$tax_value} % = {$individual_taxamountformated} \\n"; } $tax_info_message .= "\\n " . $app_strings['LBL_TOTAL_TAX_AMOUNT'] . " = {$taxtotalformated}"; $netprice = $netprice + $taxtotal; } $sc_image_tag = ''; if ($entitytype == 'Services') { $sc_image_tag = '<a href="index.php?module=ServiceContracts&action=EditView&service_id=' . $productid . '&return_module=' . $module . '&return_id=' . $focus->id . '">' . '<img border="0" src="' . vtiger_imageurl('handshake.gif', $theme) . '" title="' . getTranslatedString('Add Service Contract', $module) . '" style="cursor: pointer;" align="absmiddle" />' . '</a>'; } //For Product Name $output .= ' <tr valign="top"> <td class="crmTableRow small lineOnTop"> <font color="gray">' . $productcode . '</font> <br><font color="black">' . $productname . '</font> <br><font color="gray">' . $productdescription . '</font> <br><font color="gray">' . $comment . '</font> </td>'; //Upto this added to display the Product name and comment if ($module != 'PurchaseOrder') { $output .= '<td class="crmTableRow small lineOnTop">' . $qtyinstock . '</td>'; } $output .= '<td class="crmTableRow small lineOnTop">' . $qty . '</td>'; $output .= ' <td class="crmTableRow small lineOnTop" align="right"> <table width="100%" border="0" cellpadding="5" cellspacing="0"> <tr> <td align="right">' . $listpriceformated . '</td> </tr> <tr> <td align="right">(-) <b><a href="javascript:;" onclick="alert(\'' . $discount_info_message . '\'); ">' . $app_strings['LBL_DISCOUNT'] . ' : </a></b></td> </tr> <tr> <td align="right" nowrap>' . $app_strings['LBL_TOTAL_AFTER_DISCOUNT'] . ' : </td> </tr>'; if ($taxtype == 'individual') { $output .= ' <tr> <td align="right" nowrap>(+) <b><a href="javascript:;" onclick="alert(\'' . $tax_info_message . '\');">' . $app_strings['LBL_TAX'] . ' : </a></b></td> </tr>'; } $output .= ' </table> </td>'; $output .= ' <td class="crmTableRow small lineOnTop" align="right"> <table width="100%" border="0" cellpadding="5" cellspacing="0"> <tr><td align="right">' . $totalformated . '</td></tr> <tr><td align="right">' . $productDiscountformated . '</td></tr> <tr><td align="right" nowrap>' . $totalAfterDiscountformated . '</td></tr>'; if ($taxtype == 'individual') { $output .= '<tr><td align="right" nowrap>' . $taxtotalformated . '</td></tr>'; } $output .= ' </table> </td>'; $output .= '<td class="crmTableRow small lineOnTop" valign="bottom" align="right">' . number_format(round($netprice, 2), $decimal_precision, $decimals_separator, $thousands_separator) . '</td>'; $output .= '</tr>'; $netTotal = $netTotal + $netprice; } $output .= '</table>'; //$netTotal should be equal to $focus->column_fields['hdnSubTotal'] $netTotal = $focus->column_fields['hdnSubTotal']; $netTotalformated = number_format($netTotal, $decimal_precision, $decimals_separator, $thousands_separator); //Display the total, adjustment, S&H details $output .= '<table width="100%" border="0" cellspacing="0" cellpadding="5" class="crmTable">'; $output .= '<tr>'; $output .= '<td width="88%" class="crmTableRow small" align="right"><b>' . $app_strings['LBL_NET_TOTAL'] . '</td>'; $output .= '<td width="12%" class="crmTableRow small" align="right"><b>' . $netTotalformated . '</b></td>'; $output .= '</tr>'; //Decide discount $finalDiscount = '0.00'; $final_discount_info = '0'; //if($focus->column_fields['hdnDiscountPercent'] != '') - previously (before changing to prepared statement) the selected option (either percent or amount) will have value and the other remains empty. So we can find the non selected item by empty check. But now with prepared statement, the non selected option stored as 0 if ($focus->column_fields['hdnDiscountPercent'] != '0') { $finalDiscount = $netTotal * $focus->column_fields['hdnDiscountPercent'] / 100; $finalDiscountformated = number_format($finalDiscount, $decimal_precision, $decimals_separator, $thousands_separator); $final_discount_info = $focus->column_fields['hdnDiscountPercent'] . " % " . $app_strings['of_string'] . " {$netTotalformated} = {$finalDiscountformated}"; } elseif ($focus->column_fields['hdnDiscountAmount'] != '0') { $finalDiscount = $focus->column_fields['hdnDiscountAmount']; $finalDiscountformated = number_format($finalDiscount, $decimal_precision, $decimals_separator, $thousands_separator); $final_discount_info = $finalDiscount; } //Alert the Final Discount amount even it is zero $final_discount_info = $app_strings['LBL_FINAL_DISCOUNT_AMOUNT'] . " = {$final_discount_info}"; $final_discount_info = 'onclick="alert(\'' . $final_discount_info . '\');"'; $output .= '<tr>'; $output .= '<td align="right" class="crmTableRow small lineOnTop">(-) <b><a href="javascript:;" ' . $final_discount_info . '>' . $app_strings['LBL_DISCOUNT'] . '</a></b></td>'; $output .= '<td align="right" class="crmTableRow small lineOnTop">' . $finalDiscountformated . '</td>'; $output .= '</tr>'; if ($taxtype == 'group') { $taxtotal = '0.00'; $final_totalAfterDiscount = $netTotal - $finalDiscount; $final_totalAfterDiscountformated = number_format($final_totalAfterDiscount, $decimal_precision, $decimals_separator, $thousands_separator); $tax_info_message = $app_strings['LBL_TOTAL_AFTER_DISCOUNT'] . " = {$final_totalAfterDiscountformated} \\n"; //First we should get all available taxes and then retrieve the corresponding tax values $tax_details = getAllTaxes('available', '', 'edit', $focus->id); //if taxtype is group then the tax should be same for all products in vtiger_inventoryproductrel table for ($tax_count = 0; $tax_count < count($tax_details); $tax_count++) { $tax_name = $tax_details[$tax_count]['taxname']; $tax_label = $tax_details[$tax_count]['taxlabel']; $tax_value = $adb->query_result($result, 0, $tax_name); if ($tax_value == '' || $tax_value == 'NULL') { $tax_value = '0.00'; } $taxamount = ($netTotal - $finalDiscount) * $tax_value / 100; $taxamountformated = number_format($taxamount, $decimal_precision, $decimals_separator, $thousands_separator); $taxtotal = $taxtotal + $taxamount; $taxtotalformated = number_format($taxtotal, $decimal_precision, $decimals_separator, $thousands_separator); $tax_info_message .= "{$tax_label} : {$tax_value} % = {$taxamountformated} \\n"; } $tax_info_message .= "\\n " . $app_strings['LBL_TOTAL_TAX_AMOUNT'] . " = {$taxtotalformated}"; $output .= '<tr>'; $output .= '<td align="right" class="crmTableRow small">(+) <b><a href="javascript:;" onclick="alert(\'' . $tax_info_message . '\');">' . $app_strings['LBL_TAX'] . '</a></b></td>'; $output .= '<td align="right" class="crmTableRow small">' . $taxtotalformated . '</td>'; $output .= '</tr>'; } $shAmount = $focus->column_fields['hdnS_H_Amount'] != '' ? $focus->column_fields['hdnS_H_Amount'] : '0.00'; $shAmountformated = number_format($shAmount, $decimal_precision, $decimals_separator, $thousands_separator); $output .= '<tr>'; $output .= '<td align="right" class="crmTableRow small">(+) <b>' . $app_strings['LBL_SHIPPING_AND_HANDLING_CHARGES'] . '</b></td>'; $output .= '<td align="right" class="crmTableRow small">' . $shAmountformated . '</td>'; $output .= '</tr>'; //calculate S&H tax $shtaxtotal = '0.00'; //First we should get all available taxes and then retrieve the corresponding tax values $shtax_details = getAllTaxes('available', 'sh', 'edit', $focus->id); //if taxtype is group then the tax should be same for all products in vtiger_inventoryproductrel table $shtax_info_message = $app_strings['LBL_SHIPPING_AND_HANDLING_CHARGE'] . " = {$shAmountformated} \\n"; for ($shtax_count = 0; $shtax_count < count($shtax_details); $shtax_count++) { $shtax_name = $shtax_details[$shtax_count]['taxname']; $shtax_label = $shtax_details[$shtax_count]['taxlabel']; $shtax_percent = getInventorySHTaxPercent($focus->id, $shtax_name); $shtaxamount = $shAmount * $shtax_percent / 100; $shtaxamountformated = number_format($shtaxamount, $decimal_precision, $decimals_separator, $thousands_separator); $shtaxtotal = $shtaxtotal + $shtaxamount; $shtaxtotalformated = number_format($shtaxtotal, $decimal_precision, $decimals_separator, $thousands_separator); $shtax_info_message .= "{$shtax_label} : {$shtax_percent} % = {$shtaxamountformated} \\n"; } $shtax_info_message .= "\\n " . $app_strings['LBL_TOTAL_TAX_AMOUNT'] . " = {$shtaxtotalformated}"; $output .= '<tr>'; $output .= '<td align="right" class="crmTableRow small">(+) <b><a href="javascript:;" onclick="alert(\'' . $shtax_info_message . '\')">' . $app_strings['LBL_TAX_FOR_SHIPPING_AND_HANDLING'] . '</a></b></td>'; $output .= '<td align="right" class="crmTableRow small">' . $shtaxtotalformated . '</td>'; $output .= '</tr>'; $adjustment = $focus->column_fields['txtAdjustment'] != '' ? $focus->column_fields['txtAdjustment'] : '0.00'; $adjustmentformated = number_format($adjustment, $decimal_precision, $decimals_separator, $thousands_separator); $output .= '<tr>'; $output .= '<td align="right" class="crmTableRow small"> <b>' . $app_strings['LBL_ADJUSTMENT'] . '</b></td>'; $output .= '<td align="right" class="crmTableRow small">' . $adjustmentformated . '</td>'; $output .= '</tr>'; $grandTotal = $focus->column_fields['hdnGrandTotal'] != '' ? $focus->column_fields['hdnGrandTotal'] : '0.00'; $grandTotalformated = number_format($grandTotal, $decimal_precision, $decimals_separator, $thousands_separator); $output .= '<tr>'; $output .= '<td align="right" class="crmTableRow small lineOnTop"><b>' . $app_strings['LBL_GRAND_TOTAL'] . '</b></td>'; $output .= '<td align="right" class="crmTableRow small lineOnTop">' . $grandTotalformated . '</td>'; $output .= '</tr>'; $output .= '</table>'; $log->debug("Exiting getDetailAssociatedProducts method ..."); return $output; }
/** * * @global Users $current_user * @param ReportRun $report * @param Array $picklistArray * @param ADOFieldObject $dbField * @param Array $valueArray * @param String $fieldName * @return String */ function getReportFieldValue($report, $picklistArray, $dbField, $valueArray, $fieldName) { global $current_user; $db = PearDatabase::getInstance(); $value = $valueArray[$fieldName]; $fld_type = $dbField->type; list($module, $fieldLabel) = explode('_', $dbField->name, 2); $fieldInfo = getFieldByReportLabel($module, $fieldLabel); $fieldType = null; $fieldvalue = $value; if (!empty($fieldInfo)) { $field = WebserviceField::fromArray($db, $fieldInfo); $fieldType = $field->getFieldDataType(); } if ($fieldType == 'currency' && $value != '') { // Some of the currency fields like Unit Price, Total, Sub-total etc of Inventory modules, do not need currency conversion if ($field->getUIType() == '72') { $curid_value = explode("::", $value); $currency_id = $curid_value[0]; $currency_value = $curid_value[1]; $cur_sym_rate = getCurrencySymbolandCRate($currency_id); if ($value != '') { $formattedCurrencyValue = CurrencyField::convertToUserFormat($currency_value, null, true); $fieldvalue = CurrencyField::appendCurrencySymbol($formattedCurrencyValue, $cur_sym_rate['symbol']); } } else { $currencyField = new CurrencyField($value); $fieldvalue = $currencyField->getDisplayValue(); } } elseif ($dbField->name == "PurchaseOrder_Currency" || $dbField->name == "SalesOrder_Currency" || $dbField->name == "Invoice_Currency" || $dbField->name == "Quotes_Currency" || $dbField->name == "PriceBooks_Currency") { if ($value != '') { $fieldvalue = getTranslatedCurrencyString($value); } } elseif (in_array($dbField->name, $report->ui101_fields) && !empty($value)) { if (is_numeric($value)) { $entityNames = getEntityName('Users', $value); $fieldvalue = $entityNames[$value]; } else { $fieldvalue = $value; } } elseif ($fieldType == 'date' && !empty($value)) { if ($module == 'Calendar' && $field->getFieldName() == 'due_date') { $endTime = $valueArray['calendar_end_time']; if (empty($endTime)) { $recordId = $valueArray['calendar_id']; $endTime = getSingleFieldValue('vtiger_activity', 'time_end', 'activityid', $recordId); } $date = new DateTimeField($value . ' ' . $endTime); $fieldvalue = $date->getDisplayDate(); } else { $fieldvalue = DateTimeField::convertToUserFormat($value); } } elseif ($fieldType == "datetime" && !empty($value)) { $date = new DateTimeField($value); $fieldvalue = $date->getDisplayDateTimeValue(); } elseif ($fieldType == 'time' && !empty($value) && $field->getFieldName() != 'duration_hours' && $field->getFieldName() != 'totaltime') { $date = new DateTimeField($value); $fieldvalue = $date->getDisplayTime(); } elseif ($fieldType == "picklist" && !empty($value)) { if (is_array($picklistArray)) { if (is_array($picklistArray[$dbField->name]) && $field->getFieldName() != 'activitytype' && !in_array($value, $picklistArray[$dbField->name])) { $fieldvalue = $app_strings['LBL_NOT_ACCESSIBLE']; } else { $fieldvalue = getTranslatedString($value, $module); } } else { $fieldvalue = getTranslatedString($value, $module); } } elseif ($fieldType == "multipicklist" && !empty($value)) { if (is_array($picklistArray[1])) { $valueList = explode(' |##| ', $value); $translatedValueList = array(); foreach ($valueList as $value) { if (is_array($picklistArray[1][$dbField->name]) && !in_array($value, $picklistArray[1][$dbField->name])) { $translatedValueList[] = $app_strings['LBL_NOT_ACCESSIBLE']; } else { $translatedValueList[] = getTranslatedString($value, $module); } } } if (!is_array($picklistArray[1]) || !is_array($picklistArray[1][$dbField->name])) { $fieldvalue = str_replace(' |##| ', ', ', $value); } else { implode(', ', $translatedValueList); } } if ($fieldvalue == "") { return "-"; } $fieldvalue = str_replace("<", "<", $fieldvalue); $fieldvalue = str_replace(">", ">", $fieldvalue); $fieldvalue = decode_html($fieldvalue); if (stristr($fieldvalue, "|##|") && empty($fieldType)) { $fieldvalue = str_ireplace(' |##| ', ', ', $fieldvalue); } elseif ($fld_type == "date" && empty($fieldType)) { $fieldvalue = DateTimeField::convertToUserFormat($fieldvalue); } elseif ($fld_type == "datetime" && empty($fieldType)) { $date = new DateTimeField($fieldvalue); $fieldvalue = $date->getDisplayDateTimeValue(); } return $fieldvalue; }