address

public void modified()
{
    CustTable           curCustTable;
    Address             address,invoiceAddress,mailAddress;
    JaxInvoiceAddress   curjaxaddress,curaddress;
;
    if(JaxInvoiceTable.EajMiddleCustAccount &&JaxInvoiceTable.EajMiddleCustAccount != JaxInvoiceTable.CustAccount )
        {
            curCustTable = CustTable::find(JaxInvoiceTable.EajMiddleCustAccount,true);
            address        = DirPartyAddress::findAddress(curCustTable, AddressType::Delivery);
            invoiceAddress = DirPartyAddress::findAddress(curCustTable, AddressType::Invoice);
            mailAddress    = DirPartyAddress::findAddress(curCustTable, AddressType::Other);

            if (invoiceAddress)
            {
                JaxInvoiceTable.setEajMidInvoiceAddress(invoiceAddress);
            }
            else
            {
                JaxInvoiceTable.setEajMidInvoiceAddress(mailAddress);
            }
            if(address)
            {
                JaxInvoiceTable.setEajMidDeliveryAddress(address);
            }
            else
            {
                JaxInvoiceTable.setEajMidDeliveryAddress(mailAddress);
            }

    }

}
------------------------------------------------
void  setEajMidInvoiceAddress(Address   _address)
{
    CustTable           custTable;
    JaxInvoiceAddress   invoiceAddress;
    ;

    custTable = this.EajMidOrderAccount();

    ttsbegin;
    select forupdate invoiceAddress
                index hint InvoiceIdIdx
                where invoiceAddress.InvoiceId == this.InvoiceId;
    if (_address)
    {
        if(invoiceAddress)
        {
            invoiceAddress.EajMidBillName             = custTable.Name;
            invoiceAddress.EajMidBillAddress          = _address.Address;
            invoiceAddress.EajMidBillZipCode          = _address.ZipCode;
            invoiceAddress.EajMidBillPhone            = _address.Phone;
            invoiceAddress.EajMidBillTeleFax          = _address.TeleFax;
            invoiceAddress.EajMidBillCountryRegionId  = _address.CountryRegionId;
            invoiceAddress.EajMidBillCounty           = _address.County;
            invoiceAddress.EajMidBillState            = _address.State;
            invoiceAddress.EajMidBillStreet           = _address.Street;
            invoiceAddress.EajMidBillCity             = _address.City;
            invoiceAddress.EajMidBillTelex            = _address.Telex;
            
            invoiceAddress.EajMidBillContactPersonId  = _address.ContactPersonId;
            
            invoiceAddress.doUpdate();
        }

    }

    ttscommit;
}
posted @ 2012-08-01 15:39  perock  阅读(405)  评论(0编辑  收藏  举报