You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

510 lines
20 KiB

<!--
/*********************************************************************************
* The contents of this file are subject to the SugarCRM Public License Version 1.1.2
* ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
********************************************************************************/
/*********************************************************************************
* {APP.LBL_CURRENCY_SYM}Header: /cvsroot/sugarcrm/sugarcrm/modules/Accounts/EditView.html,v 1.16 2004/07/16 00:42:57 sugarclint Exp {APP.LBL_CURRENCY_SYM}
********************************************************************************/
-->
<!-- BEGIN: main -->
<form name="EditView" method="get" action="index.php">
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td vAlign="middle" align="left"><IMG src="{IMAGE_PATH}Quotes.gif" border="0"></td>
<td class="moduleTitle" vAlign="middle" align="left" noWrap width="100%" height="20">{MOD.LBL_QUOTE} {NAME}</td>
<td nowrap class='bodySmall' align='right'>[ <A href='http://www.vtiger.com/products/crm/document.html' target='_blank'>{APP.LNK_HELP}</A> ]</td>
</tr>
<tr><td colspan="3" class="hline"><img height='1' src='include/images/blank.gif'></td></tr></table>
<br>
<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr>
<td>
<div align="center">
<link rel="stylesheet" type="text/css" media="all" href="jscalendar/calendar-win2k-cold-1.css">
<script type="text/javascript" src="jscalendar/calendar.js"></script>
<script type="text/javascript" src="jscalendar/lang/calendar-{CALENDAR_LANG}.js"></script>
<script type="text/javascript" src="jscalendar/calendar-setup.js"></script>
<input type="hidden" name="module" value="Quotes">
<input type="hidden" name="record" value="{ID}">
<input type="hidden" name="mode" value="{MODE}">
<input type="hidden" name="action">
<input type="hidden" name="return_module" value="{RETURN_MODULE}">
<input type="hidden" name="return_id" value="{RETURN_ID}">
<input type="hidden" name="return_action" value="{RETURN_ACTION}">
<input type="hidden" name="totalProductCount">
<input title="{APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{APP.LBL_SAVE_BUTTON_KEY}" class="button" onclick="this.form.action.value='Save';settotalnoofrows();calcGrandTotal(); return validate();" type="submit" name="button" value=" {APP.LBL_SAVE_BUTTON_LABEL} " >
<input title="{APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="window.history.back()" type="button" name="button" value=" {APP.LBL_CANCEL_BUTTON_LABEL} ">
</div>
</td>
</tr>
</table>
<div align="right"><font class="required">{APP.LBL_REQUIRED_SYMBOL}</font>{APP.NTC_REQUIRED}</div>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="formOuterBorder">
<tr>
<td>
{BLOCK1_HEADER}
<table width="100%" border="0" cellspacing="1" cellpadding="0">
{BLOCK1}
</table>
</td></tr></table>
<BR>
{CUSTOMFIELD}
<BR>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="formOuterBorder">
<tr><td>
{BLOCK2_HEADER}
<table width="100%" border="0" cellspacing="1" cellpadding="0">
{BLOCK2}
</table>
</td></tr></table>
<BR>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="formOuterBorder">
<tr><td class="formBorder">
<div style="padding:2 0 2 0"><strong>{APP.LBL_PRODUCT_DETAILS}</strong></div>
<div id="productList">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="formBorder">
<tr class="moduleListTitle" height="20" id="tablehead">
<td width="20%" style="padding:3px;"><font color="red">*</font>{APP.LBL_PRODUCT}</td>
<td WIDTH='1' class='blackLine'><IMG SRC='{IMAGE_PATH}blank.gif'></td>
<td width="12%" style="padding:3px;">{APP.LBL_QTY_IN_STOCK}</td>
<td WIDTH='1' class='blackLine'><IMG SRC='{IMAGE_PATH}blank.gif'></td>
<td width="12%" style="padding:3px;"><font color="red">*</font>{APP.LBL_QTY}</td>
<td WIDTH='1' class='blackLine'><IMG SRC='{IMAGE_PATH}blank.gif'></td>
<td width="15%" style="padding:3px;">{APP.LBL_UNIT_PRICE}</td>
<td WIDTH='1' class='blackLine'><IMG SRC='{IMAGE_PATH}blank.gif'></td>
<td width="16%" style="padding:3px;"><font color="red">*</font>{APP.LBL_LIST_PRICE}</td>
<td WIDTH='1' class='blackLine'><IMG SRC='{IMAGE_PATH}blank.gif'></td>
<td width="20%" style="padding:3px;"><div align="center">{APP.LBL_TOTAL}</div></td>
<td WIDTH='1' class='blackLine'><IMG SRC='{IMAGE_PATH}blank.gif'></td>
<td width="15" style="padding:3px;"></td>
</tr>
<tr id="tableheadline">
<td colspan="14" height="1" class="blackLine"><IMG SRC="{IMAGE_PATH}blank.gif"></td>
</tr>
{ROW1}
{ASSOCIATEDPRODUCTS}
<tr id="tableheadline">
<td colspan="14" height="1" class="blackLine"><IMG SRC="{IMAGE_PATH}blank.gif"></td>
</tr>
</table>
</div>
<table width="100%" border="0" cellspacing="2" cellpadding="2" bgcolor="#FFFFFF">
<tr>
<td width="150"><input type="button" class="button" value="{APP.LBL_ADD_PRODUCT}" onClick="addRow()"></td>
<td><div align="right"><b>{APP.LBL_SUB_TOTAL}:</b></div></td>
<td width="150" style="padding-right:35"><div id="subTotal" align="right" style="border:1px solid #000;padding:2px">&nbsp;{SUBTOTAL}</div></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><div align="right"><b>{APP.LBL_TAX}:</b></div></td>
<td width="150" style="padding-right:35"><div align="right"><input type="text" id="txtTax" name="txtTax" value="{TAXVALUE}" onblur="calcGrandTotal()" style="width:100%"></div></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><div align="right"><b>{APP.LBL_ADJUSTMENT}:</b></div></td>
<td width="150" style="padding-right:35"><div align="right"><input type="text" id="txtAdjustment" name="txtAdjustment" value="{ADJUSTMENTVALUE}" onblur="calcGrandTotal()" style="width:100%"></div></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><div align="right"><b>{APP.LBL_GRAND_TOTAL}:</b></div></td>
<td width="150" style="padding-right:35"><div id="grandTotal" align="right" style="border:1px solid #000;padding:2px">&nbsp;{GRANDTOTAL}</div></td>
</tr>
</table>
<input type="hidden" name="hdnSubTotal" id="hdnSubTotal" value="{SUBTOTAL}">
<input type="hidden" name="hdnGrandTotal" id="hdnGrandTotal" value="{GRANDTOTAL}">
</td></tr></table><br>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="formOuterBorder">
<tr>
<td> {BLOCK6_HEADER}
<table width="100%" border="0" cellspacing="1" cellpadding="0">
{BLOCK6} </table></td>
</tr>
</table>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="formOuterBorder">
<tr>
<td> {BLOCK3_HEADER}
<table width="100%" border="0" cellspacing="1" cellpadding="0">
{BLOCK3} </table></td>
</tr>
</table>
<br>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><div align="center">
<input title="{APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{APP.LBL_SAVE_BUTTON_KEY}" class="button" onclick="this.form.action.value='Save';settotalnoofrows();calcGrandTotal();return validate()" type="submit" name="button" value=" {APP.LBL_SAVE_BUTTON_LABEL} " >
<input title="{APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="window.history.back()" type="button" name="button" value=" {APP.LBL_CANCEL_BUTTON_LABEL} ">
</div></td>
</tr>
</table>
</form>
<script type="text/javascript" language="JavaScript">
var prodList=getObj("productList")
var rowCnt={ROWCOUNT};
//var rowCnt=1;
var listTableStart="<table width='100%' border='0' cellspacing='0' cellpadding='0' class='formBorder'>"
function settotalnoofrows() {
document.EditView.totalProductCount.value = rowCnt;
}
function productPickList(currObj) {
var trObj=currObj.parentNode.parentNode
var rowId=parseInt(trObj.id.substr(trObj.id.indexOf("w")+1,trObj.id.length))
window.open("index.php?module=Products&action=Popup&html=Popup_picker&form=HelpDeskEditView&popuptype=inventory_prod&curr_row="+rowId,"productWin","width=600,height=400,resizable=1,scrollbars=1,top=150,left=200");
}
function priceBookPickList(currObj) {
var trObj=currObj.parentNode.parentNode
var rowId=parseInt(trObj.id.substr(trObj.id.indexOf("w")+1,trObj.id.length))
window.open("index.php?module=Products&action=PriceBookPopup&html=Popup_picker&form=EditView&popuptype=inventory_pb&fldname=txtListPrice"+rowId+"&productid="+getObj("hdnProductId"+rowId).value,"priceBookWin","width=600,height=400,resizable=1,scrollbars=1,top=150,left=200");
}
function getProdListBody() {
if (browser_ie) {
var prodListBody=getObj("productList").children[0].children[0]
} else if (browser_nn4 || browser_nn6) {
if (getObj("productList").childNodes.item(0).tagName=="TABLE") {
var prodListBody=getObj("productList").childNodes.item(0).childNodes.item(0)
} else {
var prodListBody=getObj("productList").childNodes.item(1).childNodes.item(1)
}
}
return prodListBody;
}
function addRow() {
//adding new row
rowCnt++;
if (rowCnt%2==0)
var newRow="<tr id=row"+rowCnt+" class='evenListRow'>"
else
var newRow="<tr id=row"+rowCnt+" class='oddListRow'>"
newRow+="<td style='padding:3px;'><input id='txtProduct"+rowCnt+"' name='txtProduct"+rowCnt+"' type='text' readonly> <img src='{IMAGE_PATH}search.gif' onclick='productPickList(this)' align='absmiddle' style='cursor:hand;cursor:pointer'></td>"
newRow+="<td WIDTH='1' class='blackLine'><IMG SRC='{IMAGE_PATH}blank.gif'></td>"
newRow+="<td style='padding:3px;'><div id='qtyInStock"+rowCnt+"'></div></td>"
newRow+="<td WIDTH='1' class='blackLine'><IMG SRC='{IMAGE_PATH}blank.gif'></td>"
newRow+="<td style='padding:3px;'><input type=text id='txtQty"+rowCnt+"' name='txtQty"+rowCnt+"' size='7' value='1' onBlur='calcTotal(this)'></td>"
newRow+="<td WIDTH='1' class='blackLine'><IMG SRC='{IMAGE_PATH}blank.gif'></td>"
newRow+="<td style='padding:3px;'><div id='unitPrice"+rowCnt+"'></div></td>"
newRow+="<td WIDTH='1' class='blackLine'><IMG SRC='{IMAGE_PATH}blank.gif'></td>"
newRow+="<td style='padding:3px;'><input type=text id='txtListPrice"+rowCnt+"' name='txtListPrice"+rowCnt+"' size='12' value='0.00' onBlur='calcTotal(this)'> <img src='{IMAGE_PATH}pricebook.gif' onclick='priceBookPickList(this)' align='absmiddle' style='cursor:hand;cursor:pointer'></td>"
newRow+="<td WIDTH='1' class='blackLine'><IMG SRC='{IMAGE_PATH}blank.gif'></td>"
newRow+="<td style='padding:3px;'><div id='total"+rowCnt+"' align='right'></div></td>"
newRow+="<td WIDTH='1' class='blackLine'><IMG SRC='{IMAGE_PATH}blank.gif'></td>"
newRow+="<td style='padding:3px;' align='center' width='50'><a id='delRow"+rowCnt+"' href='javascript:;' onclick='delRow(this.id)'>Del</a>"
newRow+="<input type=hidden id='hdnProductId"+rowCnt+"' name='hdnProductId"+rowCnt+"'>"
newRow+="<input type=hidden id='hdnRowStatus"+rowCnt+"' name='hdnRowStatus"+rowCnt+"'>"
newRow+="<input type=hidden id='hdnTotal"+rowCnt+"' name='hdnTotal"+rowCnt+"'></td></tr>"
var prodListBody=getProdListBody()
if (browser_nn4 || browser_nn6) {
var product=new Array(rowCnt-1)
var qty=new Array(rowCnt-1)
var listPrice=new Array(rowCnt-1)
var productId=new Array(rowCnt-1)
var total=new Array(rowCnt-1)
var rowStatus=new Array(rowCnt-1)
//alert(rowCnt)
for (var i=1,k=0;i<=rowCnt-1;i++,k++) {
product[k]=getObj("txtProduct"+i).value
qty[k]=getObj("txtQty"+i).value
listPrice[k]=getObj("txtListPrice"+i).value
total[k]=getObj("hdnTotal"+i).value
productId[k]=getObj("hdnProductId"+i).value
rowStatus[k]=getObj("hdnRowStatus"+i).value
}
}
prodList.innerHTML=listTableStart+prodListBody.innerHTML+newRow+"</table>"
if (browser_nn4 || browser_nn6) {
for (var i=1,k=0;i<=rowCnt-1;i++,k++) {
getObj("txtProduct"+i).value=product[k]
getObj("txtQty"+i).value=qty[k]
getObj("txtListPrice"+i).value=listPrice[k]
getObj("hdnTotal"+i).value=total[k]
getObj("hdnProductId"+i).value=productId[k]
getObj("hdnRowStatus"+i).value=rowStatus[k]
}
}
}
function delRow(rowId) {
var rowId=parseInt(rowId.substr(rowId.indexOf("w")+1,rowId.length))
//removing the corresponding row
var prodListBody=getProdListBody()
prodListBody.removeChild(getObj("row"+rowId))
//assigning new innerHTML after deleting a row
var newInnerHTML="<tr class='moduleListTitle' height='20' id='tablehead'>"+getObj("tablehead").innerHTML+"</tr>"
newInnerHTML+="<tr id='tableheadline'>"+getObj("tableheadline").innerHTML+"</tr>";
var rowArray=new Array(rowCnt-1);
if (browser_nn4 || browser_nn6) {
var product=new Array(rowCnt-1)
var qty=new Array(rowCnt-1)
var listPrice=new Array(rowCnt-1)
var productId=new Array(rowCnt-1)
var total=new Array(rowCnt-1)
var rowStatus=new Array(rowCnt-1)
}
for (var i=1,k=0;i<=rowId-1;i++,k++) {
if (i%2==0) var rowClass="evenListRow"
else var rowClass="oddListRow"
rowArray[k]="<tr id='row"+i+"' class='"+rowClass+"'>"+getObj("row"+i).innerHTML+"</tr>"
newInnerHTML+=rowArray[k]
if (browser_nn4 || browser_nn6) {
product[k]=getObj("txtProduct"+i).value
qty[k]=getObj("txtQty"+i).value
listPrice[k]=getObj("txtListPrice"+i).value
total[k]=getObj("hdnTotal"+i).value
productId[k]=getObj("hdnProductId"+i).value
rowStatus[k]=getObj("hdnRowStatus"+i).value
}
}
for (var i=rowId+1;i<=rowCnt;i++,k++) {
rowArray[k]=getObj("row"+i).innerHTML
var temp=rowArray[k]
temp=temp.replace("row"+i,"row"+(i-1))
temp=temp.replace("txtProduct"+i,"txtProduct"+(i-1))
temp=temp.replace("txtProduct"+i,"txtProduct"+(i-1))
temp=temp.replace("qtyInStock"+i,"qtyInStock"+(i-1))
temp=temp.replace("txtQty"+i,"txtQty"+(i-1))
temp=temp.replace("txtQty"+i,"txtQty"+(i-1))
temp=temp.replace("unitPrice"+i,"unitPrice"+(i-1))
temp=temp.replace("txtListPrice"+i,"txtListPrice"+(i-1))
temp=temp.replace("txtListPrice"+i,"txtListPrice"+(i-1))
temp=temp.replace("total"+i,"total"+(i-1))
temp=temp.replace("delRow"+i,"delRow"+(i-1))
temp=temp.replace("hdnProductId"+i,"hdnProductId"+(i-1))
temp=temp.replace("hdnProductId"+i,"hdnProductId"+(i-1))
temp=temp.replace("hdnRowStatus"+i,"hdnRowStatus"+(i-1))
temp=temp.replace("hdnRowStatus"+i,"hdnRowStatus"+(i-1))
temp=temp.replace("hdnTotal"+i,"hdnTotal"+(i-1))
temp=temp.replace("hdnTotal"+i,"hdnTotal"+(i-1))
if ((i-1)%2==0) var rowClass="evenListRow"
else var rowClass="oddListRow"
rowArray[k]="<tr id='row"+(i-1)+"' class='"+rowClass+"'>"+temp+"</tr>"
newInnerHTML+=rowArray[k]
if (browser_nn4 || browser_nn6) {
product[k]=getObj("txtProduct"+i).value
qty[k]=getObj("txtQty"+i).value
listPrice[k]=getObj("txtListPrice"+i).value
total[k]=getObj("hdnTotal"+i).value
productId[k]=getObj("hdnProductId"+i).value
rowStatus[k]=getObj("hdnRowStatus"+i).value
} }
var prodListBody=getProdListBody()
prodList.innerHTML=listTableStart+newInnerHTML+"</table>"
rowCnt--
for (var i=1,k=0;i<=rowCnt;i++,k++) {
if (browser_nn4 || browser_nn6) {
getObj("txtProduct"+i).value=product[k]
getObj("txtQty"+i).value=qty[k]
getObj("txtListPrice"+i).value=listPrice[k]
getObj("hdnTotal"+i).value=total[k]
getObj("hdnProductId"+i).value=productId[k]
getObj("hdnRowStatus"+i).value=rowStatus[k]
}
}
calcGrandTotal()
}
function calcTotal(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)
getObj("total"+rowId).innerHTML=getObj("hdnTotal"+rowId).value=roundValue(total.toString())
calcGrandTotal()
}
function calcGrandTotal() {
var subTotal=0,grandTotal=0;
for (var i=1;i<=rowCnt;i++) {
if (getObj("hdnTotal"+i).value=="")
getObj("hdnTotal"+i).value=0
if (!isNaN(getObj("hdnTotal"+i).value))
subTotal+=parseFloat(getObj("hdnTotal"+i).value)
}
grandTotal=subTotal+parseFloat(getObj("txtTax").value)+parseFloat(getObj("txtAdjustment").value)
getObj("subTotal").innerHTML=getObj("hdnSubTotal").value=roundValue(subTotal.toString())
getObj("grandTotal").innerHTML=getObj("hdnGrandTotal").value=roundValue(grandTotal.toString())
}
function roundValue(val) {
if (val.indexOf(".")<0) {
val+=".00"
} else {
var dec=val.substring(val.indexOf(".")+1,val.length)
if (dec.length>2)
val=val.substring(0,val.indexOf("."))+"."+dec.substring(0,2)
else if (dec.length==1)
val=val+"0"
}
return val;
}
</script>
<script type="text/javascript" language="Javascript">
function copyAddressRight(form) {
form.ship_street.value = form.bill_street.value;
form.ship_city.value = form.bill_city.value;
form.ship_state.value = form.bill_state.value;
form.ship_code.value = form.bill_code.value;
form.ship_country.value = form.bill_country.value;
return true;
}
function copyAddressLeft(form) {
form.bill_street.value = form.ship_street.value;
form.bill_city.value = form.ship_city.value;
form.bill_state.value = form.ship_state.value;
form.bill_code.value = form.ship_code.value;
form.bill_country.value = form.ship_country.value;
return true;
}
</script>
<script>
var fieldname = new Array({VALIDATION_DATA_FIELDNAME})
var fieldlabel = new Array({VALIDATION_DATA_FIELDLABEL})
var fielddatatype = new Array({VALIDATION_DATA_FIELDDATATYPE})
</script>
<script>
function validate() {
if(!formValidate())
return false
if(rowCnt == 0)
{
alert('No product is selected. Select atleast one Product');
return false;
}
for (var i=1;i<=rowCnt;i++) {
if (!emptyCheck("txtProduct"+i,"Product","text")) return false
if (!emptyCheck("txtQty"+i,"Qty","text")) return false
if (!numValidate("txtQty"+i,"Qty","any")) return false
if (!numConstComp("txtQty"+i,"Qty","GE","1")) return false
if (!emptyCheck("txtListPrice"+i,"List Price","text")) return false
if (!numValidate("txtListPrice"+i,"List Price","any")) return false }
if (getObj("txtTax").value.replace(/^\s+/g, '').replace(/\s+$/g, '').length>0)
if (!numValidate("txtTax","Tax","any")) return false
if (getObj("txtAdjustment").value.replace(/^\s+/g, '').replace(/\s+$/g, '').length>0)
if (!numValidate("txtAdjustment","Adjustment","any")) return false
return true
}
</script>
{JAVASCRIPT}
<!-- END: main -->