Example #1
0
        /// <summary>
        /// Saves a record to the core_petty_cash_settlement table.
        /// </summary>
        public void Insert(core_petty_cash_settlement_Objects objCls)
        {
            MySqlConnection scon = Connectivity.Cls_Connection.getConnection();
            MySqlCommand    scom = new MySqlCommand("core_petty_cash_settlementInsert", scon);

            scom.CommandType = CommandType.StoredProcedure;


            scom.Parameters.Add("COL_Id_Petty_Cash_Settlement", MySqlDbType.Int32, 0);
            scom.Parameters.Add("COL_Id_Petty_Cash_Voucher", MySqlDbType.Int32, 0);
            scom.Parameters.Add("COL_Id_Ledger_Account", MySqlDbType.Int32, 0);
            scom.Parameters.Add("COL_Id_Petty_Cash_Book", MySqlDbType.Int32, 0);
            scom.Parameters.Add("COL_Id_Petty_Cash_Category", MySqlDbType.Int32, 0);
            scom.Parameters.Add("COL_Cash_Out_Amount", MySqlDbType.Double, 0);
            scom.Parameters.Add("COL_Cash_In_Amount", MySqlDbType.Double, 0);
            scom.Parameters.Add("COL_Net_Cash_Out_Amount", MySqlDbType.Double, 0);
            scom.Parameters.Add("COL_Petty_Cash_Voucher_Remark", MySqlDbType.Text, 65535);
            scom.Parameters.Add("COL_Created_Date", MySqlDbType.DateTime, 0);
            scom.Parameters.Add("COL_Created_User", MySqlDbType.Int32, 0);
            scom.Parameters.Add("COL_Edited_Date", MySqlDbType.DateTime, 0);
            scom.Parameters.Add("COL_Edited_User", MySqlDbType.Int32, 0);
            scom.Parameters.Add("COL_Is_Active", MySqlDbType.Bit, 0);

            scom.Parameters["COL_Id_Petty_Cash_Settlement"].Value  = objCls.Id_Petty_Cash_Settlement;
            scom.Parameters["COL_Id_Petty_Cash_Voucher"].Value     = objCls.Id_Petty_Cash_Voucher;
            scom.Parameters["COL_Id_Ledger_Account"].Value         = objCls.Id_Ledger_Account;
            scom.Parameters["COL_Id_Petty_Cash_Book"].Value        = objCls.Id_Petty_Cash_Book;
            scom.Parameters["COL_Id_Petty_Cash_Category"].Value    = objCls.Id_Petty_Cash_Category;
            scom.Parameters["COL_Cash_Out_Amount"].Value           = objCls.Cash_Out_Amount;
            scom.Parameters["COL_Cash_In_Amount"].Value            = objCls.Cash_In_Amount;
            scom.Parameters["COL_Net_Cash_Out_Amount"].Value       = objCls.Net_Cash_Out_Amount;
            scom.Parameters["COL_Petty_Cash_Voucher_Remark"].Value = objCls.Petty_Cash_Voucher_Remark;
            scom.Parameters["COL_Created_Date"].Value = objCls.Created_Date;
            scom.Parameters["COL_Created_User"].Value = objCls.Created_User;
            scom.Parameters["COL_Edited_Date"].Value  = objCls.Edited_Date;
            scom.Parameters["COL_Edited_User"].Value  = objCls.Edited_User;
            scom.Parameters["COL_Is_Active"].Value    = objCls.Is_Active;


            scon.Open();
            scom.ExecuteNonQuery();
            scon.Close();
        }
        /// <summary>
        /// Saves a record to the core_petty_cash_settlement table.
        /// </summary>
        public void Insert(core_petty_cash_settlement_Objects objCls)
        {
            MySqlConnection scon = Connectivity.Cls_Connection.getConnection();
            MySqlCommand scom = new MySqlCommand("core_petty_cash_settlementInsert", scon);
            scom.CommandType = CommandType.StoredProcedure;

            scom.Parameters.Add("COL_Id_Petty_Cash_Settlement", MySqlDbType.Int32,0);
            scom.Parameters.Add("COL_Id_Petty_Cash_Voucher", MySqlDbType.Int32,0);
            scom.Parameters.Add("COL_Id_Ledger_Account", MySqlDbType.Int32,0);
            scom.Parameters.Add("COL_Id_Petty_Cash_Book", MySqlDbType.Int32,0);
            scom.Parameters.Add("COL_Id_Petty_Cash_Category", MySqlDbType.Int32,0);
            scom.Parameters.Add("COL_Cash_Out_Amount", MySqlDbType.Double,0);
            scom.Parameters.Add("COL_Cash_In_Amount", MySqlDbType.Double,0);
            scom.Parameters.Add("COL_Net_Cash_Out_Amount", MySqlDbType.Double,0);
            scom.Parameters.Add("COL_Petty_Cash_Voucher_Remark", MySqlDbType.Text,65535);
            scom.Parameters.Add("COL_Created_Date", MySqlDbType.DateTime,0);
            scom.Parameters.Add("COL_Created_User", MySqlDbType.Int32,0);
            scom.Parameters.Add("COL_Edited_Date", MySqlDbType.DateTime,0);
            scom.Parameters.Add("COL_Edited_User", MySqlDbType.Int32,0);
            scom.Parameters.Add("COL_Is_Active", MySqlDbType.Bit,0);

            scom.Parameters["COL_Id_Petty_Cash_Settlement"].Value = objCls.Id_Petty_Cash_Settlement;
            scom.Parameters["COL_Id_Petty_Cash_Voucher"].Value = objCls.Id_Petty_Cash_Voucher;
            scom.Parameters["COL_Id_Ledger_Account"].Value = objCls.Id_Ledger_Account;
            scom.Parameters["COL_Id_Petty_Cash_Book"].Value = objCls.Id_Petty_Cash_Book;
            scom.Parameters["COL_Id_Petty_Cash_Category"].Value = objCls.Id_Petty_Cash_Category;
            scom.Parameters["COL_Cash_Out_Amount"].Value = objCls.Cash_Out_Amount;
            scom.Parameters["COL_Cash_In_Amount"].Value = objCls.Cash_In_Amount;
            scom.Parameters["COL_Net_Cash_Out_Amount"].Value = objCls.Net_Cash_Out_Amount;
            scom.Parameters["COL_Petty_Cash_Voucher_Remark"].Value = objCls.Petty_Cash_Voucher_Remark;
            scom.Parameters["COL_Created_Date"].Value = objCls.Created_Date;
            scom.Parameters["COL_Created_User"].Value = objCls.Created_User;
            scom.Parameters["COL_Edited_Date"].Value = objCls.Edited_Date;
            scom.Parameters["COL_Edited_User"].Value = objCls.Edited_User;
            scom.Parameters["COL_Is_Active"].Value = objCls.Is_Active;

            scon.Open();
            scom.ExecuteNonQuery();
            scon.Close();
        }
        private void insertUpdatedVoucherDetails()
        {
            if (cmdSubmit.CommandName.ToLower() == "SAVE".ToLower())
            {
                core_petty_cash_settlement pcvsObj = new core_petty_cash_settlement();
                core_petty_cash_settlement_Objects objPCVS = new core_petty_cash_settlement_Objects();
                objPCVS.Id_Petty_Cash_Voucher = Convert.ToInt32(idPrePV.Text);
                //objPCVS.Id_Petty_Cash_Book = Convert.ToInt32(ddlPCBName.Text);
                objPCVS.Id_Petty_Cash_Book = Convert.ToInt32(hfPCBID.Value);
                //objPCVS.Id_Petty_Cash_Category = Convert.ToInt32(ddlPCCName.Text);
                objPCVS.Id_Petty_Cash_Category = Convert.ToInt32(hfPCCID.Value);
                objPCVS.Cash_Out_Amount = Convert.ToDouble(cashOutAmount.Text);
                objPCVS.Cash_In_Amount = Convert.ToDouble(cashInAmount.Text);
                objPCVS.Net_Cash_Out_Amount = Convert.ToDouble(hfnetcashOutAmount.Value);
                objPCVS.Petty_Cash_Voucher_Remark = PCV_Remark.Text;
                objPCVS.Created_Date = DateTime.Now;
                pcvsObj.Insert(objPCVS);

                //Inserting Ledger Entry & Updating Ledger Account BCF
                core_ledger_entry leObj = new core_ledger_entry();
                core_ledger_entry_Objects objLE = new core_ledger_entry_Objects();

                objLE.Id_Petty_Cash_Book = Convert.ToInt32(hfPCBID.Value);
                objLE.Id_Petty_Cash_Category = Convert.ToInt32(hfPCCID.Value);
                objLE.Id_Ledger_Account = Convert.ToInt32(hfIDLedgerAccount.Value);
                objLE.Id_Petty_Cash_Voucher = Convert.ToInt32(idPrePV.Text);

                double x = Convert.ToDouble(hfIDLedgerAccountBCF.Value);
                double y = Convert.ToDouble(cashInAmount.Text);
                objLE.Credit_Amount = Convert.ToDouble(cashInAmount.Text);
                objLE.Balance_Carried_Forward = (x - y);
                double z = (x - y);

                objLE.Created_Date = DateTime.Now;
                objLE.Post_Payment = 1;
                leObj.Insert(objLE);

                core_ledger_account laObj = new core_ledger_account();
                laObj.UpdateMethod(@"UPDATE `core_ledger_account`
                                        SET
                                        `Balance_Carried_Forward` = '" + z + @"'
                                        WHERE `Id_Ledger_Account` = '" + Convert.ToInt32(hfIDLedgerAccount.Value) + @"';");
            }

            clearFields();
            loadGrid();
        }