<apex:page Controller="ConInvoicedetailsController" showHeader="true" tabStyle="ConInvoiceList__tab" sidebar="true" id="allPage" action="{!init}" title="发票">
|
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
|
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
|
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
|
<apex:includeScript value="{!URLFOR($Resource.CommonUtilJs)}"/>
|
<apex:includeScript value="{!URLFOR($Resource.connection20)}"/>
|
<apex:includeScript value="{!URLFOR($Resource.apex20)}"/>
|
<script>
|
function setFocusOnLoad() {}
|
function bodyOnLoad(){setFocusOnLoad();}
|
function checkAll() {
|
var productCount = j$(escapeVfId('invoiceOrderRecoedsCount')).value();
|
if (j$(escapeVfId('checker')).attr('checked') == 'checked') {
|
for (var i = 0; i < productCount; i++) {
|
j$(escapeVfId('allPage:allForm:allBlock:invoiceOrderRecoedsSection:consumableorderdetails1Records:' + i + ':consumablesCountproRowCheckbox')).attr('checked',true);
|
var z = parseFloat(j$(escapeVfId('allPage:allForm:allBlock:invoiceOrderRecoedsSection:consumableorderdetails1Records:' + i+':consumablesCount')).value());
|
var x = j$(escapeVfId('allPage:allForm:allBlock:invoiceOrderRecoedsSection:consumableorderdetails1Records:' + i+':InvoiceUnitprice')).value().replace(/,/g,'');;
|
var c = parseFloat(z * x).toFixed(2);
|
document.getElementById('allPage:allForm:allBlock:invoiceOrderRecoedsSection:consumableorderdetails1Records:' + i + ':invoiceAllprice').innerHTML = c;
|
}
|
} else {
|
for (var i = 0; i < productCount; i++) {
|
j$(escapeVfId('allPage:allForm:allBlock:invoiceOrderRecoedsSection:consumableorderdetails1Records:' + i + ':consumablesCountproRowCheckbox')).attr('checked',false);
|
document.getElementById('allPage:allForm:allBlock:invoiceOrderRecoedsSection:consumableorderdetails1Records:' + i + ':invoiceAllprice').innerHTML = 0.00;
|
}
|
}
|
SumCompute();
|
}
|
|
function saveJs() {
|
save();
|
}
|
//点击金额事件
|
function ComputePriceCheck(j){
|
var z,x,c;
|
var a = j.id;
|
var i=a.substring(0,a.lastIndexOf(':'));// <apex:variable value="{!1}" var="lineNo" />
|
var a=document.getElementById (i+":invoiceAllprice");
|
z = parseFloat(j$(escapeVfId(i+':consumablesCount')).value());
|
var k = j$(escapeVfId(i+':InvoiceUnit')).value();
|
if(isNaN(z)){z=0.00;}
|
//if(k == '个'){
|
if(z<0||!(/^\d+$/.test(z))){
|
window.alert("开票单位是个时,发票数量必须是整数!");
|
z=0;
|
j$(escapeVfId(i+':consumablesCountproRowCheckbox')).attr('checked',false);
|
j$(escapeVfId(i+':consumablesCount')).val(0);
|
}
|
//}
|
x = j$(escapeVfId(i +':InvoiceUnitprice')).value().replace(/,/g,'');
|
if (j$(escapeVfId(i+':consumablesCountproRowCheckbox')).attr('checked') == 'checked') {
|
c = parseFloat(z * x).toFixed(2);
|
}else{
|
c = 0;
|
}
|
a.innerHTML = c;
|
SumCompute();
|
}
|
//点击数量事件
|
function ComputeCountCheck(j) {
|
var z,x,c,v;
|
var a = j.id;
|
var i=a.substring(0,a.lastIndexOf(':'));
|
var a=document.getElementById (i+":invoiceAllprice");
|
var x = j$(escapeVfId(i+':InvoiceUnitprice')).value();
|
z = parseFloat(j$(escapeVfId(i+':consumablesCount')).value());
|
v = j$(escapeVfId(i+':InvoiceProNotcount')).value();
|
//出库单位
|
var dw = j$(escapeVfId(i+':BoxPiece')).value();
|
//规格
|
var p = j$(escapeVfId(i+':PakingListManual')).value();
|
//开票单位
|
var k = j$(escapeVfId(i+':InvoiceUnit')).value();
|
//z= z.replace(/,/g,'');
|
if(isNaN(z)){z=0.00;}
|
/*if(isNaN(z)){
|
window.alert("发票数量必须是整数!");
|
z=0.00;
|
j$(escapeVfId(i+':consumablesCountproRowCheckbox')).attr('checked',false);
|
j$(escapeVfId(i+':consumablesCount')).val(0);}*/
|
|
if(z!=null&&z!=0&&z!=''){
|
if(dw == '盒' && k == '个'){
|
var wsl = (v * p).toFixed(0);
|
if(z<0||!(/^\d+$/.test(z))){
|
window.alert("发票数量必须是整数!");
|
z=0;
|
j$(escapeVfId(i+':consumablesCountproRowCheckbox')).attr('checked',false);
|
j$(escapeVfId(i+':consumablesCount')).val(0);
|
}else if (z > wsl){
|
window.alert("发票数量不能超过还没发票数量!");
|
j$(escapeVfId(i+':consumablesCountproRowCheckbox')).attr('checked',false);
|
j$(escapeVfId(i+':consumablesCount')).val(0);
|
a.innerHTML = 0.00;
|
}else{
|
j$(escapeVfId(i+':consumablesCountproRowCheckbox')).attr('checked',true);
|
x = j$(escapeVfId(i+':InvoiceUnitprice')).value().replace(/,/g,'');
|
c = parseFloat(z * x).toFixed(2);
|
//c = number_format_common (c,2,'.',',');
|
a.innerHTML = c;
|
}
|
}else{
|
//if(k == '个'){
|
if(z<0||!(/^\d+$/.test(z))){
|
window.alert("发票数量必须是整数!");
|
z=0;
|
j$(escapeVfId(i+':consumablesCountproRowCheckbox')).attr('checked',false);
|
j$(escapeVfId(i+':consumablesCount')).val(0);
|
}else if (z > v){
|
window.alert("发票数量不能超过还没发票数量!");
|
j$(escapeVfId(i+':consumablesCountproRowCheckbox')).attr('checked',false);
|
j$(escapeVfId(i+':consumablesCount')).val(0);
|
a.innerHTML = 0.00;
|
}else{
|
j$(escapeVfId(i+':consumablesCountproRowCheckbox')).attr('checked',true);
|
x = j$(escapeVfId(i+':InvoiceUnitprice')).value().replace(/,/g,'');
|
c = parseFloat(z * x).toFixed(2);
|
//c = number_format_common (c,2,'.',',');
|
a.innerHTML = c;
|
}
|
/*}else{
|
if (z > v){
|
window.alert("发票数量不能超过还没发票数量!");
|
j$(escapeVfId(i+':consumablesCountproRowCheckbox')).attr('checked',false);
|
j$(escapeVfId(i+':consumablesCount')).val(0);
|
a.innerHTML = 0.00;
|
}else{
|
j$(escapeVfId(i+':consumablesCountproRowCheckbox')).attr('checked',true);
|
x = j$(escapeVfId(i+':InvoiceUnitprice')).value().replace(/,/g,'');
|
c = parseFloat(z * x).toFixed(2);
|
//c = number_format_common (c,2,'.',',');
|
a.innerHTML = c;
|
}
|
}*/
|
|
}
|
|
}else{
|
j$(escapeVfId(i+':consumablesCountproRowCheckbox')).attr('checked',false);
|
a.innerHTML = 0;
|
}
|
SumCompute();
|
}
|
|
function changeInvoiceUnitprice(j,BoxPiece){
|
var p,u,c,x,b;
|
var val =j.value;
|
var a = j.id;
|
var i=a.substring(0,a.lastIndexOf(':'));
|
//发票票面金额(元)
|
var a=document.getElementById (i+":invoiceAllprice");
|
//发票单价
|
var v =document.getElementById (i+":InvoiceUnitprice");
|
|
//发票数量
|
var z = j$(escapeVfId(i+':consumablesCount')).value();
|
//规格
|
p = j$(escapeVfId(i+':PakingListManual')).value();
|
if(BoxPiece == '盒' && val == '个'){
|
j$(escapeVfId(i+':consumablesCountproRowCheckbox')).attr('checked',true);
|
//出货单价
|
u = j$(escapeVfId(i+':DeliveryListRMB')).value().replace(/,/g,'');
|
//发票单价
|
c = parseFloat(u / p).toFixed(8);
|
//发票金额
|
x = parseFloat(c * z).toFixed(2);
|
|
c = number_format_common (c,8,'.',',');
|
|
v.innerHTML = c;
|
a.innerHTML = x;
|
}else if(BoxPiece == '盒' && val == '盒'){
|
j$(escapeVfId(i+':consumablesCountproRowCheckbox')).attr('checked',true);
|
//出货单价
|
u = j$(escapeVfId(i+':DeliveryListRMB')).value().replace(/,/g,'');
|
//发票单价
|
c = parseFloat(u).toFixed(8);
|
//发票金额
|
x = parseFloat(c * z).toFixed(2);
|
c = number_format_common (c,8,'.',',');
|
|
v.innerHTML = c;
|
a.innerHTML = x;
|
}
|
SumCompute();
|
}
|
|
//要求多向联动
|
function SumCompute(){
|
var SumPrice = 0;
|
var consumablesCounttestPriceJList = j$("span[Id$='invoiceAllprice']").value();
|
//判断是否为数组 为数组时去掉空值计算
|
if (consumablesCounttestPriceJList.constructor == Array) {
|
for (var i = 0; i < consumablesCounttestPriceJList.length; i++) {
|
var outer = consumablesCounttestPriceJList[i];
|
if (isNaN(parseFloat(consumablesCounttestPriceJList[i]))) {
|
consumablesCounttestPriceJList.splice(i,1);
|
i= i-1;
|
}
|
}
|
var str=consumablesCounttestPriceJList.join("+");
|
var SumPrice =eval(str);
|
}else{
|
var SumPrice = consumablesCounttestPriceJList;
|
}
|
SumPrice = parseFloat(SumPrice).toFixed(2);
|
SumPrice = number_format_common (SumPrice,2,'.',',');
|
document.getElementById("allPage:allForm:allBlock:invoiceOrderRecoedsSection:sumPrice_buttom").innerHTML = SumPrice;
|
}
|
window.sfdcPage.appendToOnloadQueue(function() {SumCompute();});
|
|
function closeandreloadJs(){
|
window.opener.top.location.reload();
|
window.top.close();
|
}
|
|
</script>
|
<style>
|
.dateFormat {
|
display: none;
|
}
|
tr.dataRow {
|
background-color:white;
|
}
|
td.columus {
|
background-color:white;
|
text-align: right;
|
}
|
tr.dataRow:hover {
|
background-color: #e3f3ff;
|
}
|
</style>
|
<apex:form id="allForm">
|
<apex:actionFunction name="save" action="{!save}" rerender="message" onComplete="unblockUI();">
|
</apex:actionFunction>
|
<apex:pageBlock id="allBlock" >
|
<apex:pageBlock >
|
<table>
|
<colgroup>
|
<col width="150px"/>
|
<col width="200px"/>
|
<col width="200px"/>
|
<col width="200px"/>
|
<col width="200px"/>
|
<col width="200px"/>
|
<col width="90px"/>
|
<col width="100px"/>
|
<col width="10px"/>
|
<col width="85px"/>
|
<col width="100px"/>
|
<col width="10px"/>
|
<col width="70px"/>
|
<col width="100px"/>
|
</colgroup>
|
<tr>
|
<td></td>
|
<td colspan="2"><apex:commandButton value="确定" onclick="saveJs(); return false;" style="width: 150px;" rerender="dummy" /></td>
|
<td></td>
|
</tr>
|
</table>
|
|
<apex:pageblocksection columns="1" title="发票信息" collapsible="false">
|
<apex:pageBlockSectionItem >
|
<apex:outputLabel value="发票号:"/>
|
<apex:outputText value="{!invoicecode.Name}"/>
|
</apex:pageBlockSectionItem>
|
<apex:pageBlockSectionItem >
|
<apex:outputLabel value="客户名:"/>
|
<apex:outputText value="{!invoicecode.ShipmentAccount__c}"/>
|
</apex:pageBlockSectionItem>
|
<apex:pageBlockSectionItem >
|
<apex:outputLabel value="科室:"/>
|
<apex:outputText value="{!invoicecode.Order_ForCustomerText__c}"/>
|
</apex:pageBlockSectionItem>
|
</apex:pageblocksection>
|
|
<apex:pageblocksection columns="1" title="出库单" collapsible="false">
|
<apex:pageBlockSectionItem >
|
<apex:outputLabel value="出库单编码:"/>
|
<apex:outputField value="{!coc.name}"/>
|
</apex:pageBlockSectionItem>
|
<apex:pageBlockSectionItem >
|
<apex:outputLabel value="出库日期:"/>
|
<apex:outputField value="{!coc.Outbound_Date__c}"/>
|
</apex:pageBlockSectionItem>
|
</apex:pageblocksection>
|
</apex:pageBlock>
|
<apex:outputPanel id="message">
|
<apex:pageMessages />
|
</apex:outputPanel>
|
|
<apex:pageBlock id="invoiceOrderRecoedsSection" title="出库单明细">
|
<input type="hidden" id="invoiceOrderRecoedsCount" value="{!invoiceOrderRecoedsCount}" />
|
<table class="list" border="0" cellpadding="0" cellspacing="0">
|
<tr class="headerRow">
|
<th><input type='checkbox' onClick='checkAll()' id='checker'/>选择</th>
|
<th>产品型号</th>
|
<th>规格</th>
|
<th>出货单价(元)</th>
|
<th>出货数量</th>
|
<th>返品数量</th>
|
<th>出库单位</th>
|
<th>已发票数量</th>
|
<th>还没发票数量</th>
|
<th>开票单位</th>
|
<th>发票单价</th>
|
<th>发票数量</th>
|
<th>发票票面金额(元)</th>
|
</tr>
|
<apex:repeat value="{!consumableorderdetails1Records}" var="records" id="consumableorderdetails1Records">
|
<tr class="dataRow">
|
<td>
|
<apex:inputCheckbox onclick="ComputePriceCheck(this)" value="{!records.check}" id="consumablesCountproRowCheckbox" />
|
<apex:inputCheckbox value="{!records.oldCheck}" id="proRowOldCheckbox" style="display:none"/></td>
|
<td Class="dataCell">
|
<apex:outputField value="{!records.esd.Asset_Model_No__c}"/></td>
|
<td class="dataCell" align="right"><apex:outputText value="{!records.Packing_list_manual}" id="PakingListManual"/></td>
|
<td class="dataCell" align="right"><apex:outputField value="{!records.esd.Delivery_List_RMB__c}" id="DeliveryListRMB"/></td>
|
<td class="dataCell" align="right"><apex:outputField value="{!records.esd.Shipment_Count__c}" id="ShipmentCount"/></td>
|
<td class="dataCell" align="right"><apex:outputField value="{!records.esd.RrturnPro_count__c}"/></td>
|
<td class="dataCell"><apex:outputField value="{!records.esd.Box_Piece__c}" id="BoxPiece"/></td>
|
<td class="dataCell" align="right"><apex:outputField value="{!records.esd.Invoiced_Procount__c}" id="InvoicedProcount"/></td>
|
<td class="dataCell" align="right"><apex:outputField value="{!records.esd.InvoiceProNot_count__c}" id="InvoiceProNotcount"/></td>
|
<td class="dataCell">
|
<apex:selectList value="{!records.esd.Invoice_Unit__c}" size="1" style="width:75px;" onchange="changeInvoiceUnitprice(this,'{!records.esd.Box_Piece__c}');return false;" disabled="{!IF(records.esd.Box_Piece__c =='个' || (records.esd.Box_Piece__c =='盒' && records.Packing_list_manual ==1),true,false)}" id="InvoiceUnit"><apex:selectOptions value="{!records.Invoice_UnitOpts}"/>
|
</apex:selectList>
|
</td>
|
<td class="dataCell" align="right"><apex:outputField value="{!records.esd.Invoice_Unitprice__c}" id="InvoiceUnitprice"/></td>
|
<td class="dataCell"><div style="width:2px;height:20px;background-color:red; position:absolute;margin-right:5px;"></div><apex:inputText onblur="ComputeCountCheck(this)" value="{!records.invoiceCount}" id="consumablesCount"/></td>
|
<td class="dataCell" align="right"><apex:outputText value="{!records.invoiceAllprice}" id="invoiceAllprice"/></td>
|
</tr>
|
</apex:repeat>
|
</table>
|
<table class="list" cellpadding="0" cellspacing="0" border="none">
|
<tr>
|
<td style="border: none;"></td>
|
<td style="border: none;"></td>
|
<td style="border: none;"></td>
|
<td style="border: none;"></td>
|
<td style="border: none;"></td>
|
<td style="border: none;"></td>
|
<td style="border: none;"></td>
|
<td style="border: none;"></td>
|
<td style="border: none;"></td>
|
<td style="border: none;text-align: right;"><apex:outputText id="sumPrice_buttom" value="{!sumPrice}"/></td>
|
</tr>
|
</table>
|
</apex:pageBlock>
|
</apex:pageBlock>
|
</apex:form>
|
</apex:page>
|