[Vtigercrm-commits] [vtiger-commits] r6204 - in /vtigercrm/trunk: Smarty/templates/ include/js/ include/language/ include/utils/ modules/Products/

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Fri May 19 17:19:02 EDT 2006


Author: saraj
Date: Fri May 19 15:18:51 2006
New Revision: 6204

Log:
* Modified to handle the tax informations in Product Details

Modified:
    vtigercrm/trunk/Smarty/templates/ProductDetails.tpl
    vtigercrm/trunk/Smarty/templates/ProductDetailsEditView.tpl
    vtigercrm/trunk/include/js/Inventory.js
    vtigercrm/trunk/include/js/general.js
    vtigercrm/trunk/include/language/en_us.lang.php
    vtigercrm/trunk/include/utils/EditViewUtils.php
    vtigercrm/trunk/include/utils/ListViewUtils.php
    vtigercrm/trunk/modules/Products/Product.js

Modified: vtigercrm/trunk/Smarty/templates/ProductDetails.tpl
==============================================================================
--- vtigercrm/trunk/Smarty/templates/ProductDetails.tpl (original)
+++ vtigercrm/trunk/Smarty/templates/ProductDetails.tpl Fri May 19 15:18:51 2006
@@ -12,6 +12,8 @@
 
 -->*}
 
+<script type="text/javascript" src="include/js/Inventory.js"></script>
+<script type="text/javascript" src="include/js/general.js"></script>
 <!-- Added this file to display and hanld the Product Details in Inventory module  -->
 
    <tr>
@@ -27,37 +29,65 @@
 			<th width="20%"><font color='red'>*</font>{$APP.LBL_PRODUCT}</th>
 
 			{if $MODULE eq 'Quotes' || $MODULE eq 'SalesOrder' || $MODULE eq 'Invoice'}
-			<th width="12%">{$APP.LBL_QTY_IN_STOCK}</th>
+			<th width="10%">{$APP.LBL_QTY_IN_STOCK}</th>
 			{/if}
 
 			<th width="10%"><font color='red'>*</font>{$APP.LBL_QTY}</th>
 			<th width="10%">{$APP.LBL_UNIT_PRICE}</th>
-			<th width="19%"><font color='red'>*</font>{$APP.LBL_LIST_PRICE}</th>
+			<th width="15%"><font color='red'>*</font>{$APP.LBL_LIST_PRICE}</th>
+			<th width="20%">{$APP.LBL_TAX_CALCULATION}</th>
 			<th width="10%">{$APP.LBL_TOTAL}</th>
 
 			<th width="5%">&nbsp;</th>
 		   </tr>
 		   <tr id="row1" class="dvtCellLabel">
-			<td nowrap>
+			<td nowrap valign="top">
 				<input type="text"  id="txtProduct1" name="txtProduct1" class="txtBox" readonly />&nbsp;<img src="themes/blue/images/search.gif" style="cursor: pointer;" align="absmiddle" onclick="productPickList(this,'{$MODULE}')" />
 			</td>
 
 			{if $MODULE eq 'Quotes' || $MODULE eq 'SalesOrder' || $MODULE eq 'Invoice'}
-			   <td style="padding:3px;"><div id="qtyInStock1"></div>&nbsp;</td>
+			   <td style="padding:3px;" id="qtyInStock1" valign="top">&nbsp;</td>
 			{/if}
 
-			<td>
+			<td valign="top">
 				<input type="text" id="txtQty1" name="txtQty1" class="detailedViewTextBox" onfocus="this.className='detailedViewTextBoxOn'" onBlur="FindDuplicate(); settotalnoofrows(); calcTotal(this)" />
 			</td>
-			<td style="padding:3px;">
-				<div id="unitPrice1"></div>&nbsp;
+			<td style="padding:3px;"  id="unitPrice1" valign="top">&nbsp;
+				
 			</td>
-			<td nowrap>
+			<td nowrap valign="top">
 				<input type="text" id="txtListPrice1" name="txtListPrice1" class="txtBox" readonly onBlur="FindDuplicate(); settotalnoofrows(); calcTotal(this)"/>&nbsp;<img src="themes/blue/images/pricebook.gif" onclick="priceBookPickList(this)" style="cursor: pointer;" title="Price Book" align="absmiddle" />
 			</td>
-			<td style="padding:3px;">
-				<div id="total1" align="right"></div>&nbsp;
+			<!-- Added for Tax calculation-->
+			<td valign="top">
+				<input type="text" id="txtTaxTotal1" name="txtTaxTotal1" value="" class="detailedViewTextBox" style="width:65%;">
+				<input type="hidden" id="hdnTaxTotal1" name="hdnTaxTotal1">
+				&nbsp;<input type="button" name="showTax" value=" ... "  class="classBtnSmall"  onclick="fnshow_Hide('tax_Lay1');">
+
+				<!-- This div is added to display the tax informations -->
+				<div id="tax_Lay1" style="width:100%;position:relative;border:0px solid #CCCCCC;background-color:#FFFFFF;display:none;">
+					<table width="100%" border="0" cellpadding="0" cellspacing="0" class="small">
+					   <tr id="row1">
+						<td align="left" width="40%"><input type="text" id="txtVATTax1" name="txtVATTax1" class="txtBox" onBlur="ValidateTax('txtVATTax1'); calcTotal(this);"/>%&nbsp;</td>
+						<td width="20%" align="right">{$APP.LBL_VAT}</td>
+						<td align="left" width="40%"><input type="text" id="txtVATTaxTotal1" name="txtVATTaxTotal1" class="txtBox" onBlur="ValidateTax('txtVATTaxTotal1'); calcTotal(this);"/></td>
+					   </tr>
+					   <tr id="row1">
+						<td align="left"><input type="text" id="txtSalesTax1" name="txtSalesTax1" class="txtBox" onBlur="ValidateTax('txtSalesTax1'); calcTotal(this);"/>%&nbsp;</td>
+						<td  align="right">{$APP.LBL_SALES}</td>
+						<td align="left"><input type="text" id="txtSalesTaxTotal1" name="txtSalesTaxTotal1" class="txtBox" onBlur="ValidateTax('txtSalesTaxTotal1'); calcTotal(this);"/></td>
+					   </tr>
+					   <tr id="row1">
+						<td align="left"><input type="text" id="txtServiceTax1" name="txtServiceTax1" class="txtBox" onBlur="ValidateTax('txtServiceTax1'); calcTotal(this);"/>%&nbsp;</td>
+						<td align="right">{$APP.LBL_SERVICE}</td>
+						<td align="left"><input type="text" id="txtServiceTaxTotal1" name="txtServiceTaxTotal1" class="txtBox" onBlur="ValidateTax('txtServiceTaxTotal1'); calcTotal(this);"/></td>
+					   </tr>
+					</table>
+				</div>
+				<!-- This above div is added to display the tax informations --> 
+
 			</td>
+			<td style="padding:3px;" id="total1">&nbsp;</td>
 			<td>
 				<input type="hidden" id="hdnProductId1" name="hdnProductId1">
 				<input type="hidden" id="hdnRowStatus1" name="hdnRowStatus1">
@@ -121,3 +151,4 @@
 	</td>
    </tr>
 
+

Modified: vtigercrm/trunk/Smarty/templates/ProductDetailsEditView.tpl
==============================================================================
--- vtigercrm/trunk/Smarty/templates/ProductDetailsEditView.tpl (original)
+++ vtigercrm/trunk/Smarty/templates/ProductDetailsEditView.tpl Fri May 19 15:18:51 2006
@@ -12,11 +12,12 @@
 
 -->*}
 
-
+<script type="text/javascript" src="include/js/Inventory.js"></script>
+<script type="text/javascript" src="include/js/general.js"></script>
 <!-- Added to display the Product Details -->
 		<table class="prdTab"  border="0" cellspacing="0" cellpadding="2" id="proTab">
 		   <tr>
-			<th colspan="7" class="detailedViewHeader">
+			<th colspan="8" class="detailedViewHeader">
 				<b>{$APP.LBL_PRODUCT_DETAILS}</b>
 			</th>
 		   </tr>
@@ -24,12 +25,13 @@
 			<th width="20%"><font color='red'>*</font>{$APP.LBL_PRODUCT}</th>
 
 			{if $MODULE eq 'Quotes' || $MODULE eq 'SalesOrder' || $MODULE eq 'Invoice'}
-			   <th width="12%">{$APP.LBL_QTY_IN_STOCK}</th>
+			   <th width="10%">{$APP.LBL_QTY_IN_STOCK}</th>
 			{/if}
 
 			<th width="10%"><font color='red'>*</font>{$APP.LBL_QTY}</th>
 			<th width="10%">{$APP.LBL_UNIT_PRICE}</th>
-			<th width="19%"><font color='red'>*</font>{$APP.LBL_LIST_PRICE}</th>
+			<th width="15%"><font color='red'>*</font>{$APP.LBL_LIST_PRICE}</th>
+			<th width="20%">{$APP.LBL_TAX_CALCULATION}</th>
 			<th width="10%">{$APP.LBL_TOTAL}</th>
 
 			<th width="5%">&nbsp;</th>
@@ -46,29 +48,62 @@
 			{assign var="hdnRowStatus" value="hdnRowStatus"|cat:$row_no}
 			{assign var="hdnTotal" value="hdnTotal"|cat:$row_no}
 
+			{assign var="txtVATTax" value="txtVATTax"|cat:$row_no}
+			{assign var="txtSalesTax" value="txtSalesTax"|cat:$row_no}
+			{assign var="txtServiceTax" value="txtServiceTax"|cat:$row_no}
+
 		   <tr id="row{$row_no}" class="dvtCellLabel">
-			<td nowrap>
+			<td nowrap valign="top">
 				<input type="text" name="{$txtProduct}" value="{$data.$txtProduct}" class="detailedViewProdTextBox" readonly />&nbsp;<img src="themes/blue/images/search.gif" style="cursor: pointer;" align="absmiddle" onclick="productPickList(this,'{$MODULE}')" />
 			</td>
 
 			{if $MODULE eq 'Quotes' || $MODULE eq 'SalesOrder' || $MODULE eq 'Invoice'}
-			   <td style="padding:3px;"><div id="{$qtyInStock}">{$data.$qtyInStock}</div>&nbsp;</td>
+			   <td style="padding:3px;" valign="top"><div id="{$qtyInStock}">{$data.$qtyInStock}</div>&nbsp;</td>
 			{/if}
 
-			<td>
+			<td valign="top">
 				<input type="text" name="{$txtQty}" value="{$data.$txtQty}" class="detailedViewTextBox" onfocus="this.className='detailedViewTextBoxOn'" onBlur="FindDuplicate(); settotalnoofrows(); calcTotal(this)" />
 			</td>
-			<td style="padding:3px;">
+			<td style="padding:3px;" valign="top">
 				<div id="{$unitPrice}">{$data.$unitPrice}</div>&nbsp;
 			</td>
-			<td nowrap>
+			<td nowrap valign="top">
 				<input type="text" name="{$txtListPrice}" value="{$data.$txtListPrice}" class="detailedViewProdTextBox" readonly onBlur="FindDuplicate(); settotalnoofrows(); calcTotal(this)"/>&nbsp;
 				<img src="themes/blue/images/pricebook.gif" onclick="priceBookPickList(this)" style="cursor: pointer;" title="Price Book" align="absmiddle" />
 			</td>
-			<td style="padding:3px;">
+			<!-- Added for Tax calculation-->
+			<td valign="top">
+				<input type="text" id="txtTaxTotal{$row_no}" name="txtTaxTotal{$row_no}" value="" class="detailedViewTextBox" style="width:65%;">
+				<input type="hidden" id="hdnTaxTotal{$row_no}" name="hdnTaxTotal{$row_no}">
+				&nbsp;<input type="button" name="showTax" value=" ... "  class="classBtnSmall"  onclick="fnshow_Hide('tax_Lay{$row_no}');">
+
+				<!-- This div is added to display the tax informations -->
+				<div id="tax_Lay{$row_no}" style="width:100%;position:relative;border:0px solid #CCCCCC;background-color:#FFFFFF;display:none;">
+					<table width="100%" border="0" cellpadding="2" cellspacing="0" class="small">
+					   <tr id="row{$row_no}">
+						<td align="left" width="40%"><input type="text" id="txtVATTax{$row_no}" name="txtVATTax{$row_no}" class="txtBox" value="{$data.$txtVATTax}" onBlur="ValidateTax('txtVATTax{$row_no}'); calcTotal(this);"/>%&nbsp;</td>
+						<td width="20%" align="right">{$APP.LBL_VAT}</td>
+						<td align="left" width="40%"><input type="text" id="txtVATTaxTotal{$row_no}" name="txtVATTaxTotal{$row_no}" class="txtBox" value="" onBlur="ValidateTax('txtVATTaxTotal{$row_no}'); calcTotal(this);"/></td>
+					   </tr>
+					   <tr id="row{$row_no}">
+						<td align="left"><input type="text" id="txtSalesTax{$row_no}" name="txtSalesTax{$row_no}" class="txtBox" value="{$data.$txtSalesTax}" onBlur="ValidateTax('txtSalesTax{$row_no}'); calcTotal(this);"/>%&nbsp;</td>
+						<td  align="right">{$APP.LBL_SALES}</td>
+						<td align="left"><input type="text" id="txtSalesTaxTotal{$row_no}" name="txtSalesTaxTotal{$row_no}" class="txtBox" value="" onBlur="ValidateTax('txtSalesTaxTotal{$row_no}'); calcTotal(this);"/></td>
+					   </tr>
+					   <tr id="row{$row_no}">
+						<td align="left"><input type="text" id="txtServiceTax{$row_no}" name="txtServiceTax{$row_no}" class="txtBox" value="{$data.$txtServiceTax}" onBlur="ValidateTax('txtServiceTax{$row_no}'); calcTotal(this);"/>%&nbsp;</td>
+						<td align="right">{$APP.LBL_SERVICE}</td>
+						<td align="left"><input type="text" id="txtServiceTaxTotal{$row_no}" name="txtServiceTaxTotal{$row_no}" class="txtBox" value="" onBlur="ValidateTax('txtServiceTaxTotal{$row_no}'); calcTotal(this);"/></td>
+					   </tr>
+					</table>
+				</div>
+				<!-- This above div is added to display the tax informations --> 
+
+
+			<td style="padding:3px;" valign="top">
 				<div id="{$total}" align="right">{$data.$total}</div>&nbsp;
 			</td>
-			<td>
+			<td valign="top">
 				<input type="hidden" id="{$hdnProductId}" name="{$hdnProductId}" value="{$data.$hdnProductId}">
 				<input type="hidden" id="{$hdnRowStatus}" name="{$hdnRowStatus}">
 				<input type="hidden" id="{$hdnTotal}" name="{$hdnTotal}" value="{$data.$hdnTotal}">&nbsp;

Modified: vtigercrm/trunk/include/js/Inventory.js
==============================================================================
--- vtigercrm/trunk/include/js/Inventory.js (original)
+++ vtigercrm/trunk/include/js/Inventory.js Fri May 19 15:18:51 2006
@@ -164,10 +164,18 @@
 
 
 function calcTotal(currObj) {
+
+	calcTaxTotal(currObj)
+
 	var trObj=currObj.parentNode.parentNode
 	var rowId=parseInt(trObj.id.substr(trObj.id.indexOf("w")+1,trObj.id.length))
 
-	var total=eval(getObj("txtQty"+rowId).value*getObj("txtListPrice"+rowId).value)
+	var tax_total = 0
+	if(getObj("txtTaxTotal"+rowId).value > 0)
+		tax_total = getObj("txtTaxTotal"+rowId).value;
+
+	var total=eval(getObj("txtQty"+rowId).value*getObj("txtListPrice"+rowId).value)+eval(tax_total)
+
 	getObj("total"+rowId).innerHTML=getObj("hdnTotal"+rowId).value=roundValue(total.toString())
 	calcGrandTotal()
 }
@@ -256,3 +264,45 @@
         return true;
 }
 
+function fnshow_Hide(Lay){
+    var tagName = document.getElementById(Lay);
+   	if(tagName.style.display == 'none')
+   		tagName.style.display = 'block';
+	else
+		tagName.style.display = 'none';
+}
+
+function ValidateTax(txtObj)
+{
+	temp= /^\d+\.\d+$/.test(document.getElementById(txtObj).value);
+	if(temp == false)
+		alert("Please enter Valid TAX value");
+}
+
+function calcTaxTotal(currObj)
+{
+	var trObj=currObj.parentNode.parentNode
+	var rowId=parseInt(trObj.id.substr(trObj.id.indexOf("w")+1,trObj.id.length))
+
+	var vat_total=0.0;
+	var sales_total=0.0;
+	var service_total=0.0;
+
+	var temp_total = eval(getObj("txtQty"+rowId).value*getObj("txtListPrice"+rowId).value);
+
+	if(getObj("txtVATTax"+rowId).value > 0)
+		vat_total = eval(getObj("txtVATTax"+rowId).value*temp_total/100.00)
+	if(getObj("txtSalesTax"+rowId).value > 0)
+		sales_total=eval(getObj("txtSalesTax"+rowId).value*temp_total/100.00)
+	if(getObj("txtServiceTax"+rowId).value > 0)
+		service_total=eval(getObj("txtServiceTax"+rowId).value*temp_total/100.00)
+
+	var total = vat_total + sales_total + service_total
+
+	getObj("txtVATTaxTotal"+rowId).value = vat_total
+	getObj("txtSalesTaxTotal"+rowId).value = sales_total
+	getObj("txtServiceTaxTotal"+rowId).value = service_total
+
+	//set the tax total
+	getObj("txtTaxTotal"+rowId).value=getObj("hdnTaxTotal"+rowId).value=roundValue(total.toString())
+}

Modified: vtigercrm/trunk/include/js/general.js
==============================================================================
--- vtigercrm/trunk/include/js/general.js (original)
+++ vtigercrm/trunk/include/js/general.js Fri May 19 15:18:51 2006
@@ -1389,13 +1389,27 @@
 	var colfive = row.insertCell(4);
 	var colsix = row.insertCell(5);
 	var colseven = row.insertCell(6);
+	var coleight = row.insertCell(7);
+
+	colone.style.verticalAlign = 'top';
+	coltwo.style.verticalAlign = 'top';
+	colthree.style.verticalAlign = 'top';
+	colfour.style.verticalAlign = 'top';
+	colfive.style.verticalAlign = 'top';
+	colsix.style.verticalAlign = 'top';
+	colseven.style.verticalAlign = 'top';
+	coleight.style.verticalAlign = 'top';
+	
 	colone.innerHTML="<input type='text' id='txtProduct"+count+"' name='txtProduct"+count+"' class='txtBox' readonly/>&nbsp;<img src='themes/blue/images/search.gif' onclick='productPickList(this,\""+module+"\")' align='absmiddle' /><input type='hidden' id='hdnProductId"+count+"' name='hdnProductId"+count+"'>";
 	coltwo.innerHTML="<div id='qtyInStock"+count+"'>";	
 	colthree.innerHTML="<input type='text' id='txtQty"+count+"' name='txtQty"+count+"' class='detailedViewTextBox' onfocus='this.className=\"detailedViewTextBoxOn\"' onBlur='this.className=\"detailedViewTextBox\"; FindDuplicate(); settotalnoofrows(); calcTotal(this);' /> ";
 	colfour.innerHTML="&nbsp;</div><div id='unitPrice"+count+"'></div>";
 	colfive.innerHTML="<input type='text' id='txtListPrice"+count+"' name='txtListPrice"+count+"' class='txtBox' readonly onBlur='FindDuplicate(); settotalnoofrows(); calcTotal(this)'>&nbsp;<img src='themes/blue/images/pricebook.gif' onClick='priceBookPickList(this)' align='absmiddle' style='cursor:hand;cursor:pointer' title='Price Book' /> ";
-	colsix.innerHTML="&nbsp;<div id='total"+count+"' align='right'></div><input type='hidden' id='hdnTotal"+count+"' name='hdnTotal"+count+"'>";
-	colseven.innerHTML="<span class='delTxt' onclick=\"deleteRow(this.parentNode.parentNode.rowIndex)\">Del</span>";
+	//Added for tax calculation
+	colsix.innerHTML="<input type='text' id='txtTaxTotal"+count+"' name='txtTaxTotal"+count+"' value='' class='detailedViewTextBox' style='width:65%;'><input type='hidden' id='hdnTaxTotal"+count+"' name='hdnTaxTotal"+count+"'>&nbsp;<input type='button' name='showTax' value=' ... '  class='classBtnSmall'  onclick='fnshow_Hide(\"tax_Lay"+count+"\");'><div id='tax_Lay"+count+"' style='width:100%;position:relative;border:0px solid #CCCCCC;background-color:#FFFFFF;display:none;'><table width='100%' border='0' cellpadding='2' cellspacing='0' class='small'><tr id='row"+count+"'><td align='left' width='40%'><input type='text' id='txtVATTax"+count+"' name='txtVATTax"+count+"' class='txtBox' onBlur='ValidateTax(\"txtVATTax"+count+"\"); calcTotal(this);'/>%&nbsp;</td><td width='20%' align='right'>VAT</td><td align='left' width='40%'><input type='text' id='txtVATTaxTotal"+count+"' name='txtVATTaxTotal"+count+"' class='txtBox' onBlur='ValidateTax(\"txtVATTaxTotal"+count+"\"); calcTotal(this);'/></td></tr><tr id='row"+count+"'><td align='left'><input type='text' id='txtSalesTax"+count+"' name='txtSalesTax"+count+"' class='txtBox' onBlur='ValidateTax(\"txtSalesTax"+count+"\"); calcTotal(this);'/>%&nbsp;</td><td  align='right'>Sales</td><td align='left'><input type='text' id='txtSalesTaxTotal"+count+"' name='txtSalesTaxTotal"+count+"' class='txtBox' onBlur='ValidateTax(\"txtSalesTaxTotal"+count+"\"); calcTotal(this);'/></td></tr><tr id='row"+count+"'><td align='left'><input type='text' id='txtServiceTax"+count+"' name='txtServiceTax"+count+"' class='txtBox' onBlur='ValidateTax(\"txtServiceTax"+count+"\"); calcTotal(this);'/>%&nbsp;</td><td align='right'>Service</td><td align='left'><input type='text' id='txtServiceTaxTotal"+count+"' name='txtServiceTaxTotal"+count+"' class='txtBox' onBlur='ValidateTax(\"txtServiceTaxTotal"+count+"\"); calcTotal(this);'/></td></tr></table></div>";
+
+	colseven.innerHTML="&nbsp;<div id='total"+count+"' align='right'></div><input type='hidden' id='hdnTotal"+count+"' name='hdnTotal"+count+"'>";
+	coleight.innerHTML="<span class='delTxt' onclick=\"deleteRow(this.parentNode.parentNode.rowIndex)\">Del</span>";
 
 }
 function fnAddRowForPO(module){
@@ -1416,15 +1430,29 @@
 	var colfour = row.insertCell(3);
 	var colfive = row.insertCell(4);
 	var colsix = row.insertCell(5);
+	var colseven = row.insertCell(6);
+
+	colone.style.verticalAlign = 'top';
+	coltwo.style.verticalAlign = 'top';
+	colthree.style.verticalAlign = 'top';
+	colfour.style.verticalAlign = 'top';
+	colfive.style.verticalAlign = 'top';
+	colsix.style.verticalAlign = 'top';
+	colseven.style.verticalAlign = 'top';
+
 	colone.innerHTML="<input type='text'id='txtProduct"+count+"' name='txtProduct"+count+"' class='txtBox' readonly/>&nbsp;<img src='themes/blue/images/search.gif' onclick='productPickList(this,\""+module+"\")' align='absmiddle' /><input type='hidden' id='hdnProductId"+count+"' name='hdnProductId"+count+"'>";
 	coltwo.innerHTML="<input type='text'id='txtQty"+count+"' name='txtQty"+count+"' class='detailedViewTextBox' onfocus='this.className=\"detailedViewTextBoxOn\"' onBlur='this.className=\"detailedViewTextBox\"; FindDuplicate(); settotalnoofrows(); calcTotal(this);' /> ";
 	colthree.innerHTML="&nbsp;<div id='unitPrice"+count+"'></div>";
 	colfour.innerHTML="<input type='text' id='txtListPrice"+count+"' name='txtListPrice"+count+"' class='txtBox' readonly onBlur='FindDuplicate(); settotalnoofrows(); calcTotal(this)'>&nbsp;<img src='themes/blue/images/pricebook.gif' onClick='priceBookPickList(this)' align='absmiddle' style='cursor:hand;cursor:pointer' title='Price Book' /> ";
-	colfive.innerHTML="&nbsp;<div id='total"+count+"' align='right'></div><input type='hidden' id='hdnTotal"+count+"' name='hdnTotal"+count+"'>";
-	colsix.innerHTML="<span class='delTxt' onclick=\"deleteRow(this.parentNode.parentNode.rowIndex)\">Del</span>";
-
-}
-  
+
+	//Added for tax calculation
+	colfive.innerHTML="<input type='text' id='txtTaxTotal"+count+"' name='txtTaxTotal"+count+"' value='' class='detailedViewTextBox' style='width:65%;'><input type='hidden' id='hdnTaxTotal"+count+"' name='hdnTaxTotal"+count+"'>&nbsp;<input type='button' name='showTax' value=' ... '  class='classBtnSmall'  onclick='fnshow_Hide(\"tax_Lay"+count+"\");'><div id='tax_Lay"+count+"' style='width:100%;position:relative;border:0px solid #CCCCCC;background-color:#FFFFFF;display:none;'><table width='100%' border='0' cellpadding='2' cellspacing='0' class='small'><tr id='row"+count+"'><td align='left' width='40%'><input type='text' id='txtVATTax"+count+"' name='txtVATTax"+count+"' class='txtBox' onBlur='ValidateTax(\"txtVATTax"+count+"\"); calcTotal(this);'/>%&nbsp;</td><td width='20%' align='right'>VAT</td><td align='left' width='40%'><input type='text' id='txtVATTaxTotal"+count+"' name='txtVATTaxTotal"+count+"' class='txtBox' onBlur='ValidateTax(\"txtVATTaxTotal"+count+"\"); calcTotal(this);'/></td></tr><tr id='row"+count+"'><td align='left'><input type='text' id='txtSalesTax"+count+"' name='txtSalesTax"+count+"' class='txtBox' onBlur='ValidateTax(\"txtSalesTax"+count+"\"); calcTotal(this);'/>%&nbsp;</td><td  align='right'>Sales</td><td align='left'><input type='text' id='txtSalesTaxTotal"+count+"' name='txtSalesTaxTotal"+count+"' class='txtBox' onBlur='ValidateTax(\"txtSalesTaxTotal"+count+"\"); calcTotal(this);'/></td></tr><tr id='row"+count+"'><td align='left'><input type='text' id='txtServiceTax"+count+"' name='txtServiceTax"+count+"' class='txtBox' onBlur='ValidateTax(\"txtServiceTax"+count+"\"); calcTotal(this);'/>%&nbsp;</td><td align='right'>Service</td><td align='left'><input type='text' id='txtServiceTaxTotal"+count+"' name='txtServiceTaxTotal"+count+"' class='txtBox' onBlur='ValidateTax(\"txtServiceTaxTotal"+count+"\"); calcTotal(this);'/></td></tr></table></div>";
+
+	colsix.innerHTML="&nbsp;<div id='total"+count+"' align='right'></div><input type='hidden' id='hdnTotal"+count+"' name='hdnTotal"+count+"'>";
+	colseven.innerHTML="<span class='delTxt' onclick=\"deleteRow(this.parentNode.parentNode.rowIndex)\">Del</span>";
+
+}
+ 
  
 function deleteRow(i)
 {

Modified: vtigercrm/trunk/include/language/en_us.lang.php
==============================================================================
--- vtigercrm/trunk/include/language/en_us.lang.php (original)
+++ vtigercrm/trunk/include/language/en_us.lang.php Fri May 19 15:18:51 2006
@@ -868,6 +868,8 @@
 'LBL_VAT'=>'VAT',
 'LBL_SALES'=>'Sales',
 'LBL_SERVICE'=>'Service',
+'LBL_TAX_DETAILS'=>'Tax Details',
+'LBL_TAX_CALCULATION'=>'Tax Calculation',
 
 );
 

Modified: vtigercrm/trunk/include/utils/EditViewUtils.php
==============================================================================
--- vtigercrm/trunk/include/utils/EditViewUtils.php (original)
+++ vtigercrm/trunk/include/utils/EditViewUtils.php Fri May 19 15:18:51 2006
@@ -1208,6 +1208,11 @@
 		$product_Detail[$i]['hdnRowStatus'.$i] = '';
 		$product_Detail[$i]['hdnTotal'.$i] = $total;
 
+		//Added to pass the tax percentage values
+		$product_Detail[$i]['txtVATTax'.$i] = getProductTaxPercentage('VAT',$productid,'default');
+		$product_Detail[$i]['txtSalesTax'.$i] = getProductTaxPercentage('Sales',$productid,'default');
+		$product_Detail[$i]['txtServiceTax'.$i] = getProductTaxPercentage('Service',$productid,'default');
+
 	}
 	$log->debug("Exiting getAssociatedProducts method ...");
 	return $product_Detail;

Modified: vtigercrm/trunk/include/utils/ListViewUtils.php
==============================================================================
--- vtigercrm/trunk/include/utils/ListViewUtils.php (original)
+++ vtigercrm/trunk/include/utils/ListViewUtils.php Fri May 19 15:18:51 2006
@@ -1267,17 +1267,25 @@
 				elseif($popuptype == "inventory_prod")
 				{
 					$row_id = $_REQUEST['curr_row'];
-					
+
+					$vattax = getProductTaxPercentage('VAT',$entity_id,'default');
+					$salestax = getProductTaxPercentage('Sales',$entity_id,'default');
+					$servicetax = getProductTaxPercentage('Service',$entity_id,'default');
+
 					$unitprice=$adb->query_result($list_result,$list_result_count,'unit_price');
 					$qty_stock=$adb->query_result($list_result,$list_result_count,'qtyinstock');
-					$value = '<a href="a" LANGUAGE=javascript onclick=\'set_return_inventory("'.$entity_id.'", "'.br2nl($temp_val).'", "'.$unitprice.'", "'.$qty_stock.'", "'.$row_id.'"); window.close()\'>'.$temp_val.'</a>';
+					$value = '<a href="a" LANGUAGE=javascript onclick=\'set_return_inventory("'.$entity_id.'", "'.br2nl($temp_val).'", "'.$unitprice.'", "'.$qty_stock.'", "'.$vattax.'","'.$salestax.'","'.$servicetax.'","'.$row_id.'"); window.close()\'>'.$temp_val.'</a>';
 				}
 				elseif($popuptype == "inventory_prod_po")
 				{
 					$row_id = $_REQUEST['curr_row'];
 
+					$vattax = getProductTaxPercentage('VAT',$entity_id,'default');
+					$salestax = getProductTaxPercentage('Sales',$entity_id,'default');
+					$servicetax = getProductTaxPercentage('Service',$entity_id,'default');
+
 					$unitprice=$adb->query_result($list_result,$list_result_count,'unit_price');
-					$value = '<a href="a" LANGUAGE=javascript onclick=\'set_return_inventory_po("'.$entity_id.'", "'.br2nl($temp_val).'", "'.$unitprice.'", "'.$row_id.'"); window.close()\'>'.$temp_val.'</a>';
+					$value = '<a href="a" LANGUAGE=javascript onclick=\'set_return_inventory_po("'.$entity_id.'", "'.br2nl($temp_val).'", "'.$unitprice.'", "'.$vattax.'","'.$salestax.'","'.$servicetax.'","'.$row_id.'"); window.close()\'>'.$temp_val.'</a>';
 				}
 				elseif($popuptype == "inventory_pb")
 				{

Modified: vtigercrm/trunk/modules/Products/Product.js
==============================================================================
--- vtigercrm/trunk/modules/Products/Product.js (original)
+++ vtigercrm/trunk/modules/Products/Product.js Fri May 19 15:18:51 2006
@@ -60,20 +60,30 @@
         opener.document.location.href="index.php?module={RETURN_MODULE}&action=updateRelations&smodule={SMODULE}&destination_module=Products&entityid="+entity_id+"&parid="+recordid;
 }
 
-function set_return_inventory(product_id,product_name,unitprice,qtyinstock,curr_row) {
+function set_return_inventory(product_id,product_name,unitprice,qtyinstock,vattax,salestax,servicetax,curr_row) {
         window.opener.document.EditView.elements["txtProduct"+curr_row].value = product_name;
         window.opener.document.EditView.elements["hdnProductId"+curr_row].value = product_id;
 	window.opener.document.EditView.elements["txtListPrice"+curr_row].value = unitprice;
 	getOpenerObj("unitPrice"+curr_row).innerHTML = unitprice;
 	getOpenerObj("qtyInStock"+curr_row).innerHTML = qtyinstock;
+
+	getOpenerObj("txtVATTax"+curr_row).value = vattax;
+	getOpenerObj("txtSalesTax"+curr_row).value = salestax;
+	getOpenerObj("txtServiceTax"+curr_row).value = servicetax;
+
 	window.opener.document.EditView.elements["txtQty"+curr_row].focus()
 }
 
-function set_return_inventory_po(product_id,product_name,unitprice,curr_row) {
+function set_return_inventory_po(product_id,product_name,unitprice,vattax,salestax,servicetax,curr_row) {
         window.opener.document.EditView.elements["txtProduct"+curr_row].value = product_name;
         window.opener.document.EditView.elements["hdnProductId"+curr_row].value = product_id;
 	window.opener.document.EditView.elements["txtListPrice"+curr_row].value = unitprice;
 	getOpenerObj("unitPrice"+curr_row).innerHTML = unitprice;
+
+	getOpenerObj("txtVATTax"+curr_row).value = vattax;
+	getOpenerObj("txtSalesTax"+curr_row).value = salestax;
+	getOpenerObj("txtServiceTax"+curr_row).value = servicetax;
+
 	window.opener.document.EditView.elements["txtQty"+curr_row].focus()
 }
 





More information about the vtigercrm-commits mailing list