Ejemplo n.º 1
0
        /// <summary>
        /// id=3 stands for transfer issue from factory ...
        /// </summary>
        /// <param name="maxTrNo"></param>
        /// <returns></returns>
        private string GenerateTransferIssueRef(int maxTrNo)
        {
            string refCode   = _iCommonGateway.GetAllSubReferenceAccounts().ToList().Find(n => n.Id == Convert.ToInt32(ReferenceType.Transfer)).Code;
            string temp      = (maxTrNo + 1).ToString();
            string reference = DateTime.Now.Year.ToString().Substring(2, 2) + refCode + temp;

            return(reference);
        }
Ejemplo n.º 2
0
        public string SaveDeliveredOrder(List <ScannedProduct> scannedProducts, Delivery aDelivery, int invoiceStatus, int orderStatus)
        {
            string refCode = _iCommonGateway.GetAllSubReferenceAccounts().ToList().Find(n => n.Id == Convert.ToInt32(ReferenceType.Distribution)).Code;

            aDelivery.VoucherNo = GetMaxVoucherNoByTransactionInfix(refCode);
            int maxRefNo    = _iInventoryGateway.GetMaxDeliveryRefNoOfCurrentYear();
            var deliveryRef = GenerateDeliveryReference(maxRefNo);

            aDelivery.DeliveryRef = deliveryRef;
            aDelivery.MessageModel.TransactionRef = deliveryRef;
            int rowAffected = _iInventoryGateway.SaveDeliveredOrder(scannedProducts, aDelivery, invoiceStatus, orderStatus);

            return(rowAffected > 0 ? "Saved Successfully!" : "Failed to Save");
        }
Ejemplo n.º 3
0
        //-----------13-Sep-2018-----------
        public string Save(IEnumerable <OrderItem> orderItems, Invoice anInvoice)
        {
            string refCode = _iCommonGateway.GetAllSubReferenceAccounts().ToList().Find(n => n.Id == Convert.ToInt32(ReferenceType.Invoice)).Code;
            int    maxSl   = _iInvoiceGateway.GetMaxInvoiceNoOfCurrentYear();

            anInvoice.InvoiceNo  = _iInvoiceGateway.GetMaxInvoiceNo() + 1;
            anInvoice.InvoiceRef = GenerateInvoiceRef(maxSl);
            anInvoice.VoucherNo  = GetMaxVoucherNoByTransactionInfix(refCode);

            int rowAffected = _iInvoiceGateway.Save(orderItems, anInvoice);

            if (rowAffected > 0)
            {
                return("Saved Invoice information Successfully!");
            }
            return("Failed to Save");
        }
Ejemplo n.º 4
0
        private string GetReferenceAccountCodeById(int subReferenceAccountId)
        {
            var code = _iCommonGateway.GetAllSubReferenceAccounts().ToList().Find(n => n.Id.Equals(subReferenceAccountId)).Code;

            return(code);
        }
Ejemplo n.º 5
0
 public IEnumerable <ViewReferenceAccountModel> GetAllSubReferenceAccounts()
 {
     return(_iCommonGateway.GetAllSubReferenceAccounts());
 }