Exemple #1
0
        public int InsertGeneralPaymrnt(EMGeneralPayment objGeneralPymt)
        {
            Hashtable htparams = new Hashtable {
                { "@GeneralPymtId", objGeneralPymt.GeneralPymtId },
                { "@FromAccCodeId", objGeneralPymt.FromAccCodeId },
                { "@MainAcCode", objGeneralPymt.FmMainAcCode },
                { "@ToMainAcCode", objGeneralPymt.ToMainAcCode },
                { "@ToAccCodeId", objGeneralPymt.ToAccCodeId },
                { "@PaymentAmount", objGeneralPymt.PaymentAmount },
                { "@PaymentDate", objGeneralPymt.PaymentDate },
                { "@CreatedBy", objGeneralPymt.CreatedBy },
                { "@CategoryId", objGeneralPymt.CategoryId },
            };

            return(ExecuteNonQuery("GeneralPayment_Insert", htparams));
        }
Exemple #2
0
 public int InsertGeneralPaymrnt(EMGeneralPayment objEmGeneralPayment)
 {
     return(_objDAgenpaymt.InsertGeneralPaymrnt(objEmGeneralPayment));
 }
    private void InsertGeneralPayment()
    {
        try
        {
            EMGeneralPayment _objEmGenPytmAc = new EMGeneralPayment();
            _objEmGenPytmAc.FromAccCodeId = Convert.ToInt32(ddlFmAccCode.SelectedValue);

            _objEmGenPytmAc.ToAccCodeId = Convert.ToInt32(ddlToAccCode.SelectedValue.ToString());
            // _objEmGenPytmAc.ToMainAcCode =
            _objEmGenPytmAc.PaymentAmount = Convert.ToDecimal(txtpytmAmount.Text);
            _objEmGenPytmAc.CategoryId    = Convert.ToInt32(ddlCategory.SelectedValue);
            _objEmGenPytmAc.PaymentDate   = Convert.ToDateTime(txtDate.Text);
            _objEmGenPytmAc.CreatedBy     = 0;

            DataSet ds = _objBAGencategory.Get_MainAccCode(Convert.ToInt32(ddlToAccCode.SelectedValue));
            if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                _objEmGenPytmAc.FmMainAcCode = ds.Tables[0].Rows[0]["MainAcName"].ToString();
            }
            if (ds.Tables.Count > 0 && ds.Tables[1].Rows.Count > 0)
            {
                _objEmGenPytmAc.ToMainAcCode = ds.Tables[1].Rows[0]["ChartedAccName"].ToString();
            }


            int Result = _objBAGencategory.InsertGeneralPaymrnt(_objEmGenPytmAc);
            if (Result > 0)
            {
                Transaction objTransaction = new Transaction();

                objTransaction.FmAccountNoId        = Convert.ToInt32(ddlFmAccCode.SelectedValue);
                objTransaction.ReferenceAccountNoId = Convert.ToInt32(ddlToAccCode.SelectedValue);
                string  category      = "";
                DataSet Dsaccount     = _objBALTransactions.Transaction_GetAccountsData(Convert.ToInt32(ddlFmAccCode.SelectedValue), Convert.ToInt32(ddlToAccCode.SelectedValue), "GPT", category);
                string  FmAcccode     = "";
                string  FmMainAccCode = "";
                string  RefMainAcc    = "";
                string  RefAccCode    = "";

                if (Dsaccount.Tables[0].Rows.Count > 0)
                {
                    RefAccCode = Dsaccount.Tables[0].Rows[0]["AccCode"].ToString();
                    RefMainAcc = Dsaccount.Tables[0].Rows[0]["MainAccCode"].ToString();
                }

                if (Dsaccount.Tables[1].Rows.Count > 0)
                {
                    FmAcccode     = Dsaccount.Tables[1].Rows[0]["BankGiAccount"].ToString();
                    FmMainAccCode = Dsaccount.Tables[1].Rows[0]["MainAccCode"].ToString();
                }


                objTransaction.CreditAmount       = string.IsNullOrEmpty(txtpytmAmount.Text) ? (0.0M) : Convert.ToDecimal(txtpytmAmount.Text);
                objTransaction.FmAccountNO        = FmAcccode;
                objTransaction.FmMainAccount      = FmMainAccCode;
                objTransaction.ToMainAccount      = RefAccCode;
                objTransaction.ReferenceAccountNO = RefAccCode;
                objTransaction.DebitAmount        = 0;
                objTransaction.ReferenceNo        = "0";
                // objTransaction.InvoiceId = Convert.ToInt32(hfInvId.Value);
                // objTransaction.InvoiceNo = "";

                objTransaction.ReferenceType = "GPT";
                objTransaction.CreatedBy     = 0;

                objTransaction.BalanceAmount = 0;
                _objBALTransactions.TransactionInsert(objTransaction);



                //objTransaction.CreditAmount = string.IsNullOrEmpty(txtpytmAmount.Text) ? (0.0M) : Convert.ToDecimal(txtpytmAmount.Text);
                //objTransaction.FmAccountNO = RefAccCode;
                //objTransaction.FmMainAccount = RefMainAcc;
                //objTransaction.ReferenceAccountNO = FmAcccode;
                //objTransaction.DebitAmount = 0;
                //objTransaction.ReferenceNo = "0";

                //objTransaction.ReferenceType = "GPT";
                //objTransaction.CreatedBy = 0;

                //objTransaction.BalanceAmount = 0;
                //_objBALTransactions.TransactionInsert(objTransaction);

                lblMsg.Text = _objBOUtiltiy.ShowMessage("success", "Success", "GeneralPayment created Successfully");

                Response.Redirect("GeneralPaymentList.aspx");
            }
            else
            {
                lblMsg.Text = _objBOUtiltiy.ShowMessage("info", "Info", "GeneralPayment  was not created please try again");
            }
        }
        catch (Exception ex)
        {
            lblMsg.Text = _objBOUtiltiy.ShowMessage("danger", "Danger", ex.Message);
            ExceptionLogging.SendExcepToDB(ex);
        }
    }