<apex:page Controller="ConInvoiceListController" 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)}"/>
<script>
function setFocusOnLoad() {}
function bodyOnLoad(){setFocusOnLoad();}
function ClearJs(){
    blockme();
    document.getElementById("allPage:allForm:searchBlock:InvoiceDateStartSearch").value = "";
    document.getElementById("allPage:allForm:searchBlock:InvoiceDateEndSearch").value = "";
    document.getElementById("allPage:allForm:searchBlock:InvoiceCodeSearch").value = "";
    document.getElementById("allPage:allForm:searchBlock:InvoiceAccountSearch").value = "";
    document.getElementById("allPage:allForm:searchBlock:InvoiceStatusSearch").value = "";
    clearUp();
}

function invoiceCodeSearchJs() {
    blockme();
    invoiceCodeSearch();
}

function newInvoiceJs() {
    blockme();
    window.open("/customer/apex/ConInvoiceView", "_self");
}

//排序
function SortLimitedJs(key) {
    blockme();
    SortLimited(key);
}

</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="invoiceCodeSearch" action="{!invoiceCodeSearch}" rerender="searchdetails,message" onComplete="unblockUI();">
    </apex:actionFunction>
    <apex:actionFunction name="clearUp" action="{!clearUp}" rerender="searchBlock,searchdetails,message" onComplete="unblockUI();">
    </apex:actionFunction>
    <apex:actionFunction name="SortLimited" action="{!SortLimited}" rerender="searchdetails, message" onComplete="unblockUI();">
        <apex:param name="firstParam" assignTo="{!sortKey}" value="" />
    </apex:actionFunction>
		<apex:outputPanel id="allPanel">
			<apex:pageBlock id="newBlock">
                <table>
                    <colgroup>
                        <col width="150px"/>
                        <col width="150px"/>
                        <col width="10px"/>
                        <col width="70px"/>
                        <col width="100px"/>
                        <col width="10px"/>
                    </colgroup>
                    <tr>
                        <td align="right"></td>
                        <td><apex:commandButton onclick="newInvoiceJs();return false;" value="新建发票" rerender="dummy" style="width:150px;" /></td>
                        <td/>
                    </tr>
                    <tr>
                        <td></td>
                    </tr>
                </table>
            </apex:pageBlock>
            <apex:pageBlock id="searchBlock" title="检索条件">
                <table>
                    <colgroup>
                        <col width="80px"/>
                        <col width="200px"/>
                        <col width="10px"/>
                        <col width="80px"/>
                        <col width="100px"/>
                        <col width="10px"/>
                        <col width="80px"/>
                        <col width="100px"/>
                        <col width="10px"/>
                        <col width="80px"/>
                        <col width="100px"/>
                        <col width="150px"/>
                        <col width="150px"/>
                    </colgroup>
                    <tr>
                        <td align="right">发票日期</td>
                        <td>从<apex:inputField id="InvoiceDateStartSearch" value="{!coc.Order_date__c}" style="width:80px"/>起</td>
                        <td/>
                        <td align="right">发票号</td>
                        <td><apex:inputtext id="InvoiceCodeSearch" value="{!category1}" style="width:80px"/></td>
                        <td/>
                        <td align="right">客户名</td>
                        <td><apex:inputtext id="InvoiceAccountSearch" value="{!category2}" style="width:80px"/></td>
                        <td/>
                        <td align="right">状态</td>
                        <td><apex:inputField id="InvoiceStatusSearch" value="{!coc.Invoice_status__c}" style="width:80px"/></td>
                        <td><apex:commandButton value="检索" style="width: 130px;" onclick="invoiceCodeSearchJs(); return false;" /></td>
                        <td><apex:commandButton value="清空" style="width: 130px;" onclick="ClearJs(); return false;" /></td>
                    </tr>
                    <tr>
                        <td align="right"></td>
                        <td valign="top">到<apex:inputField id="InvoiceDateEndSearch" value="{!coc.Deliver_date__c}" style="width:80px"/></td>
                        <td/>
                        <td align="right"></td>
                        <td></td>
                        <td/>
                        <td align="right"></td>
                        <td></td>
                        <td/>
                        <td align="right"></td>
                        <td></td>
                        <td></td>
                        <td></td>
                    </tr>
                </table>
            </apex:pageBlock>
            <apex:outputPanel id="message">
                <apex:pageMessages />
            </apex:outputPanel>
            <apex:pageBlock id="searchdetails" title="发票一览">
                <table class="list" border="0" cellpadding="0" cellspacing="0">
                    <tr class="headerRow">
                        <th><a href="#" onclick="SortLimitedJs('0');return false;" style="text-decoration: underline;">发票日期</a>{!sortOrder[0]}</th>
                        <th><a href="#" onclick="SortLimitedJs('1');return false;" style="text-decoration: underline;">发票号</a>{!sortOrder[1]}</th>
                        <th><a href="#" onclick="SortLimitedJs('2');return false;" style="text-decoration: underline;">{!$ObjectType.Consumable_order__c.fields.ShipmentAccount__c.label}</a>{!sortOrder[2]}</th>
                        <th>{!$ObjectType.Consumable_order__c.fields.Invoice_status__c.label}</th>
                        <th>发票账面金额(元)</th>
                        <th>{!$ObjectType.Consumable_order__c.fields.Invoice_attachment__c.label}</th>
                        <th>{!$ObjectType.Consumable_order__c.fields.Invoicedet_attachment__c.label}</th>
                    </tr>
                <apex:repeat value="{!raesList}" var="records" id="theRepeat">
                    <tr class="dataRow">
                        <td Class="dataCell">
                            <apex:outputField value="{!records.Invoice_Date__c}"/></td>
                        <td class="dataCell"><apex:outputLink value="/ConInvoiceView?invoiceId={!records.Id}" target="_self"><apex:outputField value="{!records.Name}"/></apex:outputLink></td>
                        <td class="dataCell"><apex:outputField value="{!records.ShipmentAccount__c}"/></td>
                        <td class="dataCell"><apex:outputField value="{!records.Invoice_status__c}"/></td>
                        <td class="dataCell" style="text-align: right;"><apex:outputField value="{!records.Invoice_total_amount__c}"/></td>
                        <td class="dataCell"><apex:outputField value="{!records.Invoice_attachment__c}"/></td>
                        <td class="dataCell"><apex:outputField value="{!records.Invoicedet_attachment__c}"/></td>
                    </tr>
                </apex:repeat>
                </table>
           </apex:pageBlock>
		</apex:outputPanel>
	</apex:form>
</apex:page>