public string SaveUpdatePartyPayment(vmSalPPBillingMaster model)
        {
            GenericFactoryFor_SalPPBillingMaster_GF = new SalPPBillingMaster_GF();
            string result = string.Empty;

            try
            {
                Hashtable ht      = new Hashtable();
                string    spQuery = string.Empty;

                #region ***********************Starts Documents Info Entry***************************
                ht.Add("LUserID", model.LUserID);
                ht.Add("LCompanyID", model.LCompanyID);
                ht.Add("LMenuID", model.LMenuID);
                ht.Add("LTransactionTypeID", model.LTransactionTypeID);
                ht.Add("TabID", model.TabID);

                ht.Add("CompanyID", model.CompanyID);
                ht.Add("BuyerID", model.BuyerID);
                ht.Add("LCID", model.LCID);
                ht.Add("DeliveryQty", model.DeliveryQty);
                ht.Add("DocumentsNo", model.DocumentsNo != null ? model.DocumentsNo : "");

                if ((model.ShipmentDate == Convert.ToDateTime("1/1/1900 12:00:00 AM")) || (model.ShipmentDate == null))
                {
                    ht.Add("ShipmentDate", "");
                }
                else
                {
                    ht.Add("ShipmentDate", model.ShipmentDate);
                }

                if (model.DocsSentDateParty == Convert.ToDateTime("1/1/1900 12:00:00 AM") || model.DocsSentDateParty == null)
                {
                    ht.Add("DocsSentDateParty", "");
                }
                else
                {
                    ht.Add("DocsSentDateParty", model.DocsSentDateParty);
                }

                if (model.SubmissionDatePartyBank == Convert.ToDateTime("1/1/1900 12:00:00 AM") || model.SubmissionDatePartyBank == null)
                {
                    ht.Add("SubmissionDatePartyBank", "");
                }
                else
                {
                    ht.Add("SubmissionDatePartyBank", model.SubmissionDatePartyBank);
                }

                if (model.DocumentsDate == Convert.ToDateTime("1/1/1900 12:00:00 AM") || model.DocumentsDate == null)
                {
                    ht.Add("DocumentsDate", "");
                }
                else
                {
                    ht.Add("DocumentsDate", model.DocumentsDate);
                }

                if (model.DocsRecieveDate == Convert.ToDateTime("1/1/1900 12:00:00 AM") || model.DocsRecieveDate == null)
                {
                    ht.Add("DocsRecieveDate", "");
                }
                else
                {
                    ht.Add("DocsRecieveDate", model.DocsRecieveDate);
                }

                if (model.PartyAcceptanceDate == Convert.ToDateTime("1/1/1900 12:00:00 AM") || model.PartyAcceptanceDate == null)
                {
                    ht.Add("PartyAcceptanceDate", "");
                }
                else
                {
                    ht.Add("PartyAcceptanceDate", model.PartyAcceptanceDate);
                }

                if (model.BankAcceptanceDate == Convert.ToDateTime("1/1/1900 12:00:00 AM") || model.BankAcceptanceDate == null)
                {
                    ht.Add("BankAcceptanceDate", "");
                }
                else
                {
                    ht.Add("BankAcceptanceDate", model.BankAcceptanceDate);
                }

                ht.Add("BankID", model.BankID);
                ht.Add("ComboID", model.ComboID);
                ht.Add("RefNo", model.RefNo != null ? model.RefNo : "");
                ht.Add("DocumentValue", model.DocumentValue);
                ht.Add("RefBillNo", model.RefBillNo != null ? model.RefBillNo : "");
                #endregion ***********************End Documents Info Entry*****************************

                #region ***********************Starts Purchase Info Entry*****************************
                ht.Add("BillMasterId", model.BillMasterId);
                ht.Add("LIB", model.LIB);
                ht.Add("ConversionRate", model.ConversionRate);
                ht.Add("SugarPAD", model.SugarPAD);
                ht.Add("ReserveMargin", model.ReserveMargin);

                if (model.PurchaseDate == Convert.ToDateTime("1/1/1900 12:00:00 AM") || model.PurchaseDate == null)
                {
                    ht.Add("PurchaseDate", "");
                }
                else
                {
                    ht.Add("PurchaseDate", model.PurchaseDate);
                }

                ht.Add("Discount", model.Discount);
                ht.Add("Percentage", model.Percentage);
                ht.Add("LIBRateOfInterest", model.LIBRateOfInterest);
                #endregion ***********************End Purchase Info Entry******************************

                #region ***********************Starts Over Due Info Entry*****************************
                if (model.PaymentIssueDate == Convert.ToDateTime("1/1/1900 12:00:00 AM") || model.PaymentIssueDate == null)
                {
                    ht.Add("PaymentIssueDate", "");
                }
                else
                {
                    ht.Add("PaymentIssueDate", model.PaymentIssueDate);
                }

                if (model.AdjustmentDate == Convert.ToDateTime("1/1/1900 12:00:00 AM") || model.AdjustmentDate == null)
                {
                    ht.Add("AdjustmentDate", "");
                }
                else
                {
                    ht.Add("AdjustmentDate", model.AdjustmentDate);
                }

                if (model.MaturityDate == Convert.ToDateTime("1/1/1900 12:00:00 AM") || model.MaturityDate == null)
                {
                    ht.Add("MaturityDate", "");
                }
                else
                {
                    ht.Add("MaturityDate", model.MaturityDate);
                }

                if (model.PaymentRecievedDate == Convert.ToDateTime("1/1/1900 12:00:00 AM") || model.PaymentRecievedDate == null)
                {
                    ht.Add("PaymentRecievedDate", "");
                }
                else
                {
                    ht.Add("PaymentRecievedDate", model.PaymentRecievedDate);
                }

                ht.Add("TotalODDaysParty", model.TotalODDaysParty);
                ht.Add("TotalODInterestParty", model.TotalODInterestParty);
                ht.Add("ODAdjustment", model.ODAdjustment);
                ht.Add("PaymentValue", model.PaymentValue);
                ht.Add("Shortfall", model.Shortfall);
                ht.Add("TotalODDaysBank", model.TotalODDaysBank);
                ht.Add("TotalODInterestBank", model.TotalODInterestBank);
                #endregion ***********************End Over Due Info Entry******************************

                spQuery = "[Set_PartyPayment]";

                result = GenericFactoryFor_SalPPBillingMaster_GF.ExecuteCommandString(spQuery, ht);
            }
            catch (Exception e)
            {
                e.ToString();
            }
            return(result);
        }