private IList <TransferItemLine> GetInvoiceLines(int invoiceNo) { var list = new List <TransferItemLine>(); _lineComp.bcSetFilterRequeryStr(string.Format("{0} = {1}", _colClpInvoiceNo, invoiceNo)); _lineComp.bcFetchFirst(0); do { var line = new TransferItemLine { ArticleNo = _lineComp.bcGetStr((int)CustomerOrderLineCopy_Properties.CLP_ArticleNo), ArticleName = _lineComp.bcGetStr((int)CustomerOrderLineCopy_Properties.CLP_Name), Price = (decimal)_lineComp.bcGetDouble((int)CustomerOrderLineCopy_Properties.CLP_ExchangeSalesPrice), DiscountInPercent1 = (decimal)_lineComp.bcGetDouble((int)CustomerOrderLineCopy_Properties.CLP_DiscountI), DiscountInPercent2 = (decimal)_lineComp.bcGetDouble((int)CustomerOrderLineCopy_Properties.CLP_DiscountII), Quantity = (decimal)_lineComp.bcGetDouble((int)CustomerOrderLineCopy_Properties.CLP_Invoiced), StockProfileNo = _lineComp.bcGetInt((int)CustomerOrderLineCopy_Properties.CLP_StockProfileNo), WareHouseNo = _lineComp.bcGetInt((int)CustomerOrderLineCopy_Properties.CLP_WareHouseNo) }; if (line.Quantity != 0) { list.Add(line); } } while (_lineComp.bcFetchNext(0) == 0); return(list); }
public bool CustomerShouldPayPostage(int customerNo) { _customerComponent.bcSetFilterRequeryStr(string.Format("{0} = {1}", _colCustomerNo, customerNo)); _customerComponent.bcFetchFirst(0); return(_customerComponent.bcGetInt((int)Customer_Properties.CUS_FixedAddnDedNo) == 1); }
public IList <TransferItem> GetInvoices(int chainNo, int loanReturnNo) { InitializeComponents(); var where = CreateFilter(chainNo, loanReturnNo); LogFileWriter.WriteLine(string.Format("Setting filter before fetching invoices: '{0}'", where)); _invoiceComp.bcSetFilterRequeryStr(where); var start = DateTime.Now; var errCode = _invoiceComp.bcFetchFirst(0); LogFileWriter.WriteLine(string.Format("Time spent fetching invoices: {0}", DateTime.Now.Subtract(start))); LogFileWriter.WriteLine(string.Format("bcGetNoOfRecords = {0}", _invoiceComp.bcGetNoOfRecords())); if (errCode != 0) { LogErrorMessage(errCode); return(new List <TransferItem>()); } var list = new List <TransferItem>(); do { var item = new TransferItem { InvoiceNo = _invoiceComp.bcGetInt((int)CustomerOrderCopy_Properties.COP_InvoiceNo), OrderNo = _invoiceComp.bcGetStr((int)CustomerOrderCopy_Properties.COP_OrderCopyNo), CustomerNo = _invoiceComp.bcGetInt((int)CustomerOrderCopy_Properties.COP_CustomerNo), CustomerName = _invoiceComp.bcGetStr((int)CustomerOrderCopy_Properties.COP_DeliveryCustomerName), CustomerContactNameForInvoice = _invoiceComp.bcGetStr((int)CustomerOrderCopy_Properties.COP_NameContactNoInvoice) }; start = DateTime.Now; item.Lines = GetInvoiceLines(item.InvoiceNo); LogFileWriter.WriteLine(string.Format("Time spent fetching lines for invoice {0}: {1}", item.InvoiceNo, DateTime.Now.Subtract(start))); if (item.Lines.Count > 0) { list.Add(item); } } while (_invoiceComp.bcFetchNext(0) == 0); return(list); }
private CustomerDiscountSettings GetCustomerDiscountSettings(int customerNo) { _customerComponent.bcSetInt((int)Customer_Properties.CUS_CustomerNo, customerNo); var fetchCode = _customerComponent.bcFetchEqual(); if (fetchCode != 0) { throw new PimIntegrationVismaObjectNotFoundException(string.Format("CustomerNo = {0} Code = {1}", customerNo, fetchCode)); } return(new CustomerDiscountSettings { CurrencyNo = _customerComponent.bcGetInt((int)Customer_Properties.CUS_CurrencyNo), ChainNo = _customerComponent.bcGetInt((int)Customer_Properties.CUS_ChainNo), PriceListNo = _customerComponent.bcGetInt((int)Customer_Properties.CUS_PriceListNo), CustomerGroupNo = _customerComponent.bcGetInt((int)Customer_Properties.CUS_CustomerGrpNo) }); }