Beispiel #1
0
        public int SaveInvoiceData(SaleInvoice saleInv, DataTable itemTable, SalePaymentDetails payDetails)
        {    //TODO: Urgent SaveInoviceData.
            int status = SaveData(saleInv);

            if (status > 0)
            {
                string invNo = sDB.GetLastInvoiceNo();
                status = SaveItemsDetails(itemTable);
                if (status > 0)
                {
                    payDetails.InvoiceNo = invNo;
                    int  status2 = -1;
                    bool modef   = false;
                    if (payDetails.PayMode == UtilOps.GetSalePayMode(SalePayMode.Card) || payDetails.PayMode == UtilOps.GetSalePayMode(SalePayMode.Mix))
                    {
                        modef = true;
                        payDetails.CardDetails.InvoiceNo = invNo;
                        status2 = SaveCardDetails(payDetails.CardDetails);
                        int cardDetailsId = 0;
                        status = SavePaymentDetails(payDetails, cardDetailsId);
                    }
                    else
                    {
                        //For CashPayment
                        status = SavePaymentDetails(payDetails, -1);
                    }

                    if (modef && status > 0 && status2 > 0)
                    {
                        return(1);
                    }
                    else if (modef == false && status > 0)
                    {
                        return(1);
                    }
                    else if (modef && status <= 0 || status2 <= 0)
                    {
                        return(-3);
                    }
                    else
                    {
                        return(-4);
                    }
                    //TODO: Make Error Code so easy to debug and handle
                }
                else
                {
                    return(-2);
                }
            }
            else
            {
                return(-1);
            }
        }
Beispiel #2
0
        public int SavePaymentDetails(SalePaymentDetails pd, int cardDetailsID)
        {
            PaymentDetails payDetails = new PaymentDetails()
            {
                CardAmount    = pd.CardAmount,
                CashAmount    = pd.CashAmount,
                InvoiceNo     = pd.InvoiceNo,
                PayMode       = pd.PayMode,
                CardDetailsID = cardDetailsID,
                ID            = pd.ID
            };

            return(payDB.InsertData(payDetails));
        }