Example #1
0
        public bool CustomerExists(int customerNo)
        {
            _customerComponent.bcSetFilterRequeryStr(string.Format("{0} = {1}", _colCustomerNo, customerNo));
            _customerComponent.bcFetchFirst(0);

            return(_customerComponent.bcGetNoOfRecords() > 0);
        }
Example #2
0
        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);
        }
Example #3
0
 public void MarkInvoiceAsTransferred(int invoiceNo)
 {
     _invoiceComp.bcSetFilterRequeryStr(string.Format("{0} = {1}", _colInvoiceNo, invoiceNo));
     _invoiceComp.bcFetchFirst(1);
     _invoiceComp.bcUpdateInt((int)CustomerOrderCopy_Properties.COP_LoanReturnNo, 1);
     _invoiceComp.bcSaveRecord();
 }
Example #4
0
        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);
        }