public static ACC_JournalMaster GetACC_JournalMasterByID(int id) { ACC_JournalMaster aCC_JournalMaster = new ACC_JournalMaster(); SqlACC_JournalMasterProvider sqlACC_JournalMasterProvider = new SqlACC_JournalMasterProvider(); aCC_JournalMaster = sqlACC_JournalMasterProvider.GetACC_JournalMasterByID(id); return aCC_JournalMaster; }
public static ACC_JournalMaster GetACC_RowStatusByRowStatusID(int RowStatusID) { ACC_JournalMaster aCC_JournalMaster = new ACC_JournalMaster(); SqlACC_JournalMasterProvider sqlACC_JournalMasterProvider = new SqlACC_JournalMasterProvider(); aCC_JournalMaster = sqlACC_JournalMasterProvider.GetACC_JournalMasterByRowStatusID(RowStatusID); return aCC_JournalMaster; }
public ACC_JournalMaster GetACC_JournalMasterFromReader(IDataReader reader) { try { ACC_JournalMaster aCC_JournalMaster = new ACC_JournalMaster ( (int)reader["ACC_JournalMasterID"], reader["JournalMasterName"].ToString(), reader["ExtraField1"].ToString(), reader["ExtraField2"].ToString(), reader["ExtraField3"].ToString(), reader["Note"].ToString(), (DateTime)reader["JournalDate"], (int)reader["AddedBy"], (DateTime)reader["AddedDate"], (int)reader["UpdatedBy"], (DateTime)reader["UpdatedDate"], (int)reader["RowStatusID"] ); return(aCC_JournalMaster); } catch (Exception ex) { return(null); } }
public ACC_JournalMaster GetACC_JournalMasterFromReader(IDataReader reader) { try { ACC_JournalMaster aCC_JournalMaster = new ACC_JournalMaster ( (int)reader["ACC_JournalMasterID"], reader["JournalMasterName"].ToString(), reader["ExtraField1"].ToString(), reader["ExtraField2"].ToString(), reader["ExtraField3"].ToString(), reader["Note"].ToString(), (DateTime)reader["JournalDate"], (int)reader["AddedBy"], (DateTime)reader["AddedDate"], (int)reader["UpdatedBy"], (DateTime)reader["UpdatedDate"], (int)reader["RowStatusID"] ); return aCC_JournalMaster; } catch(Exception ex) { return null; } }
public static ACC_JournalMaster GetACC_JournalMasterByID(int id) { ACC_JournalMaster aCC_JournalMaster = new ACC_JournalMaster(); SqlACC_JournalMasterProvider sqlACC_JournalMasterProvider = new SqlACC_JournalMasterProvider(); aCC_JournalMaster = sqlACC_JournalMasterProvider.GetACC_JournalMasterByID(id); return(aCC_JournalMaster); }
protected void btnJournalSubmit_Click(object sender, EventArgs e) { try { ACC_JournalMaster aCC_JournalMaster = new ACC_JournalMaster(); aCC_JournalMaster.JournalMasterName = Request.QueryString["Type"] != null ? Request.QueryString["Type"] : "0";//Voucher Type aCC_JournalMaster.ExtraField1 = txtReceivedOrPayto.Text; aCC_JournalMaster.ExtraField2 = txtAddress.Text; aCC_JournalMaster.ExtraField3 = ""; aCC_JournalMaster.Note = txtNote.Text; aCC_JournalMaster.JournalDate = DateTime.Parse(txtJournalMasterDate.Text); aCC_JournalMaster.AddedBy = getLogin().LoginID; aCC_JournalMaster.AddedDate = DateTime.Now; aCC_JournalMaster.UpdatedBy = getLogin().LoginID; aCC_JournalMaster.UpdatedDate = DateTime.Now; aCC_JournalMaster.RowStatusID = 1; int JournalMasterID = 0; if (Request.QueryString["Tmp"] != null) { JournalMasterID = ACC_JournalMasterManager.InsertACC_JournalMasterTmp(aCC_JournalMaster); } else { JournalMasterID = ACC_JournalMasterManager.InsertACC_JournalMaster(aCC_JournalMaster); } List <ACC_JournalDetail> aCC_Journaldetails = loadFromGrid(); foreach (ACC_JournalDetail item in aCC_Journaldetails) { item.JournalMasterID = JournalMasterID; if (Request.QueryString["Tmp"] != null) { ACC_JournalDetailManager.InsertACC_JournalDetailTmp(item); hlnkPrintVoucher.Visible = false; } else { ACC_JournalDetailManager.InsertACC_JournalDetail(item); hlnkPrintVoucher.Visible = true; } } aCC_Journaldetails = new List <ACC_JournalDetail>(); BindJournalGrid(aCC_Journaldetails); hlnkPrintVoucher.NavigateUrl = "Voucherprint.aspx?JournalMasterID=" + JournalMasterID; showAlartMessage("Successfully Done."); cleanDataJournalMaster(); } catch (Exception ex) { showAlartMessage("Error occured"); } }
private void showACC_JournalMasterData() { ACC_JournalMaster aCC_JournalMaster = new ACC_JournalMaster(); aCC_JournalMaster = ACC_JournalMasterManager.GetACC_JournalMasterByID(Int32.Parse(Request.QueryString["aCC_JournalMasterID"])); txtJournalMasterName.Text = aCC_JournalMaster.JournalMasterName; txtExtraField1.Text = aCC_JournalMaster.ExtraField1; txtExtraField2.Text = aCC_JournalMaster.ExtraField2; txtExtraField3.Text = aCC_JournalMaster.ExtraField3; txtNote.Text = aCC_JournalMaster.Note; txtJournalDate.Text = aCC_JournalMaster.JournalDate; txtAddedBy.Text = aCC_JournalMaster.AddedBy.ToString(); txtUpdatedBy.Text = aCC_JournalMaster.UpdatedBy.ToString(); txtUpdatedDate.Text = aCC_JournalMaster.UpdatedDate; ddlRowStatus.SelectedValue = aCC_JournalMaster.RowStatusID.ToString(); }
protected void btnJournalEntry_Click(object sender, EventArgs e) { ACC_JournalMaster aCC_JournalMaster = new ACC_JournalMaster(); aCC_JournalMaster.JournalMasterName = ""; aCC_JournalMaster.AddedBy = Profile.card_id; aCC_JournalMaster.AddedDate = DateTime.Now; aCC_JournalMaster.UpdatedBy = Profile.card_id; aCC_JournalMaster.UpdateDate = DateTime.Now; aCC_JournalMaster.RowStatusID = 1; aCC_JournalMaster.JournalMasterID = ACC_JournalMasterManager.InsertACC_JournalMaster(aCC_JournalMaster); foreach (ACC_Journal eachJournal in doubleEntry) { eachJournal.JournalMasterID = aCC_JournalMaster.JournalMasterID; ACC_JournalManager.InsertACC_Journal(eachJournal); } }
protected void btnAdd_Click(object sender, EventArgs e) { ACC_JournalMaster aCC_JournalMaster = new ACC_JournalMaster(); aCC_JournalMaster.JournalMasterName = txtJournalMasterName.Text; aCC_JournalMaster.ExtraField1 = txtExtraField1.Text; aCC_JournalMaster.ExtraField2 = txtExtraField2.Text; aCC_JournalMaster.ExtraField3 = txtExtraField3.Text; aCC_JournalMaster.Note = txtNote.Text; aCC_JournalMaster.JournalDate = txtJournalDate.Text; aCC_JournalMaster.AddedBy = Int32.Parse(txtAddedBy.Text); aCC_JournalMaster.AddedDate = DateTime.Now; aCC_JournalMaster.UpdatedBy = Int32.Parse(txtUpdatedBy.Text); aCC_JournalMaster.UpdatedDate = DateTime.Now; aCC_JournalMaster.RowStatusID = Int32.Parse(ddlRowStatus.SelectedValue); int resutl = ACC_JournalMasterManager.InsertACC_JournalMaster(aCC_JournalMaster); Response.Redirect("AdminACC_JournalMasterDisplay.aspx"); }
protected void btnUpdate_Click(object sender, EventArgs e) { ACC_JournalMaster aCC_JournalMaster = new ACC_JournalMaster(); aCC_JournalMaster = ACC_JournalMasterManager.GetACC_JournalMasterByID(Int32.Parse(Request.QueryString["aCC_JournalMasterID"])); ACC_JournalMaster tempACC_JournalMaster = new ACC_JournalMaster(); tempACC_JournalMaster.ACC_JournalMasterID = aCC_JournalMaster.ACC_JournalMasterID; tempACC_JournalMaster.JournalMasterName = txtJournalMasterName.Text; tempACC_JournalMaster.ExtraField1 = txtExtraField1.Text; tempACC_JournalMaster.ExtraField2 = txtExtraField2.Text; tempACC_JournalMaster.ExtraField3 = txtExtraField3.Text; tempACC_JournalMaster.Note = txtNote.Text; tempACC_JournalMaster.JournalDate = txtJournalDate.Text; tempACC_JournalMaster.AddedBy = Int32.Parse(txtAddedBy.Text); tempACC_JournalMaster.AddedDate = DateTime.Now; tempACC_JournalMaster.UpdatedBy = Int32.Parse(txtUpdatedBy.Text); tempACC_JournalMaster.UpdatedDate = DateTime.Now; tempACC_JournalMaster.RowStatusID = Int32.Parse(ddlRowStatus.SelectedValue); bool result = ACC_JournalMasterManager.UpdateACC_JournalMaster(tempACC_JournalMaster); Response.Redirect("AdminACC_JournalMasterDisplay.aspx"); }
public bool UpdateACC_JournalMaster(ACC_JournalMaster aCC_JournalMaster) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("GP_UpdateACC_JournalMaster", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ACC_JournalMasterID", SqlDbType.Int).Value = aCC_JournalMaster.ACC_JournalMasterID; cmd.Parameters.Add("@JournalMasterName", SqlDbType.NVarChar).Value = aCC_JournalMaster.JournalMasterName; cmd.Parameters.Add("@ExtraField1", SqlDbType.NVarChar).Value = aCC_JournalMaster.ExtraField1; cmd.Parameters.Add("@ExtraField2", SqlDbType.NVarChar).Value = aCC_JournalMaster.ExtraField2; cmd.Parameters.Add("@ExtraField3", SqlDbType.NVarChar).Value = aCC_JournalMaster.ExtraField3; cmd.Parameters.Add("@Note", SqlDbType.NVarChar).Value = aCC_JournalMaster.Note; cmd.Parameters.Add("@JournalDate", SqlDbType.DateTime).Value = aCC_JournalMaster.JournalDate; cmd.Parameters.Add("@AddedBy", SqlDbType.Int).Value = aCC_JournalMaster.AddedBy; cmd.Parameters.Add("@AddedDate", SqlDbType.DateTime).Value = aCC_JournalMaster.AddedDate; cmd.Parameters.Add("@UpdatedBy", SqlDbType.Int).Value = aCC_JournalMaster.UpdatedBy; cmd.Parameters.Add("@UpdatedDate", SqlDbType.DateTime).Value = aCC_JournalMaster.UpdatedDate; cmd.Parameters.Add("@RowStatusID", SqlDbType.Int).Value = aCC_JournalMaster.RowStatusID; connection.Open(); int result = cmd.ExecuteNonQuery(); return(result == 1); } }
protected void btnJournalSubmit_Click(object sender, EventArgs e) { try { ACC_JournalMaster aCC_JournalMaster = new ACC_JournalMaster(); aCC_JournalMaster.JournalMasterName = Request.QueryString["Type"] != null ? Request.QueryString["Type"] : "0";//Voucher Type aCC_JournalMaster.ExtraField1 = txtReceivedOrPayto.Text; aCC_JournalMaster.ExtraField2 = txtAddress.Text; aCC_JournalMaster.ExtraField3 = ""; aCC_JournalMaster.Note = txtNote.Text; aCC_JournalMaster.JournalDate = DateTime.Parse(txtJournalMasterDate.Text); aCC_JournalMaster.AddedBy = getLogin().LoginID; aCC_JournalMaster.AddedDate = DateTime.Now; aCC_JournalMaster.UpdatedBy = getLogin().LoginID; aCC_JournalMaster.UpdatedDate = DateTime.Now; aCC_JournalMaster.RowStatusID = 1; int JournalMasterID = 0; if (Request.QueryString["Tmp"] != null) { JournalMasterID = ACC_JournalMasterManager.InsertACC_JournalMasterTmp(aCC_JournalMaster); } else { JournalMasterID = ACC_JournalMasterManager.InsertACC_JournalMaster(aCC_JournalMaster); } List<ACC_JournalDetail> aCC_Journaldetails = loadFromGrid(); foreach (ACC_JournalDetail item in aCC_Journaldetails) { item.JournalMasterID = JournalMasterID; if (Request.QueryString["Tmp"] != null) { ACC_JournalDetailManager.InsertACC_JournalDetailTmp(item); hlnkPrintVoucher.Visible = false; } else { ACC_JournalDetailManager.InsertACC_JournalDetail(item); hlnkPrintVoucher.Visible = true; } } aCC_Journaldetails= new List<ACC_JournalDetail>(); BindJournalGrid(aCC_Journaldetails); hlnkPrintVoucher.NavigateUrl = "Voucherprint.aspx?JournalMasterID=" + JournalMasterID; showAlartMessage("Successfully Done."); cleanDataJournalMaster(); } catch (Exception ex) { showAlartMessage("Error occured"); } }
public ACC_JournalMaster GetACC_JournalMasterFromReader(IDataReader reader) { try { ACC_JournalMaster aCC_JournalMaster = new ACC_JournalMaster ( DataAccessObject.IsNULL<int>(reader["JournalMasterID"]), DataAccessObject.IsNULL<string>(reader["JournalMasterName"]), DataAccessObject.IsNULL<string>(reader["AddedBy"].ToString()), DataAccessObject.IsNULL<DateTime>(reader["AddedDate"]), DataAccessObject.IsNULL<string>(reader["UpdatedBy"].ToString()), DataAccessObject.IsNULL<DateTime>(reader["UpdateDate"]), DataAccessObject.IsNULL<int>(reader["RowStatusID"]) ); return aCC_JournalMaster; } catch(Exception ex) { return null; } }
protected void btnJournalSubmit_Click(object sender, EventArgs e) { List <ACC_HeadType> allACC_HeadType = ACC_HeadTypeManager.GetAllACC_HeadTypes(); ACC_JournalMaster aCC_JournalMaster = new ACC_JournalMaster(); aCC_JournalMaster.JournalMasterName = "1";//Voucher Type aCC_JournalMaster.ExtraField1 = ""; aCC_JournalMaster.ExtraField2 = ""; aCC_JournalMaster.ExtraField3 = ""; aCC_JournalMaster.Note = ""; aCC_JournalMaster.JournalDate = DateTime.Parse(txtJournalDate.Text); aCC_JournalMaster.AddedBy = getLogin().LoginID; aCC_JournalMaster.AddedDate = DateTime.Now; aCC_JournalMaster.UpdatedBy = getLogin().LoginID; aCC_JournalMaster.UpdatedDate = DateTime.Now; aCC_JournalMaster.RowStatusID = 1; int JournalMasterID = 0; JournalMasterID = ACC_JournalMasterManager.InsertACC_JournalMaster(aCC_JournalMaster); foreach (GridViewRow gvr in gvACC_ChartOfAccountLabel4.Rows) { HiddenField hfChartOfAccountLabel4ID = (HiddenField)gvr.FindControl("hfChartOfAccountLabel4ID"); DropDownList ddlBank = (DropDownList)gvr.FindControl("ddlBanks"); Label lblChartOfAccountLabel4Text = (Label)gvr.FindControl("lblChartOfAccountLabel4Text"); TextBox txtCashSales = (TextBox)gvr.FindControl("txtCashSales"); TextBox txtCardSaleDBBL = (TextBox)gvr.FindControl("txtCardSaleDBBL"); TextBox txtCardSaleCITY = (TextBox)gvr.FindControl("txtCardSaleCITY"); TextBox txtbKash = (TextBox)gvr.FindControl("txtbKash"); TextBox txtBankDepostiedAmount = (TextBox)gvr.FindControl("txtBankDepostiedAmount"); TextBox txtDiscountAmount = (TextBox)gvr.FindControl("txtDiscountAmount"); if (txtCashSales.Text == "0" && txtCardSaleDBBL.Text == "0" && txtCardSaleCITY.Text == "0") { continue; } try { ACC_JournalDetail aCC_JournalDetail = new ACC_JournalDetail(); aCC_JournalDetail.JournalMasterID = JournalMasterID; aCC_JournalDetail.ExtraField3 = ""; aCC_JournalDetail.ExtraField2 = ""; aCC_JournalDetail.ExtraField1 = ""; aCC_JournalDetail.AddedBy = getLogin().LoginID; aCC_JournalDetail.AddedDate = DateTime.Now; aCC_JournalDetail.UpdatedBy = getLogin().LoginID; aCC_JournalDetail.UpdatedDate = DateTime.Now; aCC_JournalDetail.RowStatusID = 1; aCC_JournalDetail.WorkStation = int.Parse(hfChartOfAccountLabel4ID.Value); aCC_JournalDetail.WorkStationName = lblChartOfAccountLabel4Text.Text; //Discount if (txtDiscountAmount.Text != "0") { //discount Expence aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = Int32.Parse(hfChartOfAccountLabel4ID.Value); aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = lblChartOfAccountLabel4Text.Text; aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Discount"; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 181; aCC_JournalDetail.Debit = Decimal.Parse(txtDiscountAmount.Text); aCC_JournalDetail.Credit = Decimal.Parse("0"); ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); //Sales revinew discount aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = 829; aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = "All products"; aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Sales revinew discount"; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 180; aCC_JournalDetail.Credit = Decimal.Parse(txtDiscountAmount.Text); aCC_JournalDetail.Debit = Decimal.Parse("0"); ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); } ////Money entry for cash sale //aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = Int32.Parse(hfChartOfAccountLabel4ID.Value); //aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = lblChartOfAccountLabel4Text.Text; //aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Cash in Hand"; //aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 1; //aCC_JournalDetail.WorkStation = aCC_JournalDetail.ACC_ChartOfAccountLabel4ID; //aCC_JournalDetail.WorkStationName = aCC_JournalDetail.ACC_ChartOfAccountLabel4Text; //aCC_JournalDetail.Debit = Decimal.Parse(txtCashSales.Text); //aCC_JournalDetail.Credit = Decimal.Parse("0"); //if (txtCashSales.Text !="0") //ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); //Money entry for bKash Sale //<option value="1803"> Brac Bank (New Account) A/C (1524-2029-8148-6001)</option> aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = Int32.Parse(hfChartOfAccountLabel4ID.Value); aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = lblChartOfAccountLabel4Text.Text; aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = 1803; aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = "Brac Bank A/C (1524-2029-8148-6001)"; aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Cash at Bank"; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 3; aCC_JournalDetail.Debit = Decimal.Parse(txtbKash.Text); aCC_JournalDetail.Credit = Decimal.Parse("0"); if (txtbKash.Text != "0") { ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); } //Money entry for Crard sale CITY aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = Int32.Parse(hfChartOfAccountLabel4ID.Value); aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = lblChartOfAccountLabel4Text.Text; aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = 823; aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = "CITY BANK - GentlePark (1401307973001)"; aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Cash at Bank"; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 3; aCC_JournalDetail.Debit = Decimal.Parse(txtCardSaleCITY.Text); aCC_JournalDetail.Credit = Decimal.Parse("0"); if (txtCardSaleCITY.Text != "0") { ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); } //Money entry for Crard sale DBBL aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = 828; aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = "DBBL-126-110-11033"; aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Cash at Bank"; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 3; aCC_JournalDetail.Debit = Decimal.Parse(txtCardSaleDBBL.Text); aCC_JournalDetail.Credit = Decimal.Parse("0"); if (txtCardSaleDBBL.Text != "0") { ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); } //bKash sales //<option value="315">bKash Sales ( (Operating income)-Sales Revenue -> Sales Revenue)</option> aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = 829; aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = "All products"; aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "bKash sales"; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 315; aCC_JournalDetail.Credit = Decimal.Parse(txtbKash.Text); aCC_JournalDetail.Debit = Decimal.Parse("0"); if (txtbKash.Text != "0") { ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); } //Cash Sales DBBL aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = 829; aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = "All products"; aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Card Sales (DBBL)"; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 107; aCC_JournalDetail.Credit = Decimal.Parse(txtCardSaleDBBL.Text); aCC_JournalDetail.Debit = Decimal.Parse("0"); if (txtCardSaleDBBL.Text != "0") { ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); } //Cash Sales CITY aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = 829; aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = "All products"; aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Card Sales (CITY)"; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 143; aCC_JournalDetail.Credit = Decimal.Parse(txtCardSaleCITY.Text); aCC_JournalDetail.Debit = Decimal.Parse("0"); if (txtCardSaleCITY.Text != "0") { ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); } if (ddlBank.SelectedValue != "0" && txtCashSales.Text != "0") //if (ddlBank.SelectedValue != "0" && txtBankDepostiedAmount.Text != "0") { //Cash Sales aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = 829; aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = "All products"; aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Cash Sale"; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 106; aCC_JournalDetail.Credit = Decimal.Parse(txtCashSales.Text); aCC_JournalDetail.Debit = Decimal.Parse("0"); ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); ////Bank Deposit //aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = Int32.Parse(hfChartOfAccountLabel4ID.Value); //aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = lblChartOfAccountLabel4Text.Text; //aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Cash in Hand"; //aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 1; //aCC_JournalDetail.WorkStation = aCC_JournalDetail.ACC_ChartOfAccountLabel4ID; //aCC_JournalDetail.WorkStationName = aCC_JournalDetail.ACC_ChartOfAccountLabel4Text; ////aCC_JournalDetail.Credit = Decimal.Parse(txtBankDepostiedAmount.Text); //aCC_JournalDetail.Credit = Decimal.Parse(txtCashSales.Text); //aCC_JournalDetail.Debit = Decimal.Parse("0"); //ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = Int32.Parse(ddlBank.SelectedValue); aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = ddlBank.SelectedItem.Text; aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Cash at Bank"; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 3; //aCC_JournalDetail.Debit = Decimal.Parse(txtBankDepostiedAmount.Text); aCC_JournalDetail.Debit = Decimal.Parse(txtCashSales.Text); aCC_JournalDetail.Credit = Decimal.Parse("0"); ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); } } catch (Exception ex) { } } hlnkPrintVoucher.Visible = true; hlnkPrintVoucher.NavigateUrl = "Voucherprint.aspx?JournalMasterID=" + JournalMasterID; }
protected void btnJournalEntry_Click(object sender, EventArgs e) { int fulltimesalryJournalID = 0; int FeesMasterJournalID = 0; List<ACC_Journal> doubleEntry = new List<ACC_Journal>(); doubleEntry = (List<ACC_Journal>)Session["doubleEntry"]; List<ACC_Check> checks = new List<ACC_Check>(); if (Session["checks"] != null) checks = (List<ACC_Check>)Session["checks"]; List<ACC_CUCCheck> cucChecks = new List<ACC_CUCCheck>(); if (Session["cucCheck"] != null) cucChecks = (List<ACC_CUCCheck>)Session["cucCheck"]; ACC_JournalMaster aCC_JournalMaster = new ACC_JournalMaster(); aCC_JournalMaster.JournalMasterName = ""; aCC_JournalMaster.AddedBy = Profile.card_id; aCC_JournalMaster.AddedDate = DateTime.Now; aCC_JournalMaster.UpdatedBy = Profile.card_id; aCC_JournalMaster.UpdateDate = DateTime.Now; aCC_JournalMaster.RowStatusID = 1; aCC_JournalMaster.JournalMasterID = ACC_JournalMasterManager.InsertACC_JournalMaster(aCC_JournalMaster); if (doubleEntry != null) { foreach (ACC_Journal eachJournal in doubleEntry) { int temp = eachJournal.HeadID; string checkno = eachJournal.JournalVoucherNo; eachJournal.JournalVoucherNo = Request.QueryString["IsAdmissionFees"] != null ? Request.QueryString["IsAdmissionFees"] : ""; eachJournal.JournalMasterID = aCC_JournalMaster.JournalMasterID; eachJournal.JournalID = ACC_JournalManager.InsertACC_Journal(eachJournal); if (eachJournal.AccountID == 17)//fulltime salary { fulltimesalryJournalID = eachJournal.JournalID; } if (eachJournal.SubBasicAccountID == 20)//student Fees { FeesMasterJournalID = eachJournal.JournalID; } if (checkno != "") { foreach (ACC_Check check in checks) { if (checkno == check.CheckNo) { //teamporary we have used the login that //we will keep in the JournalVoucherNo the checkno //then //in the insert script we will update the JournalVoucherNo with the CheckID check.ExtraField3 = eachJournal.JournalID.ToString(); ACC_CheckManager.InsertACC_Check(check); } } } else { foreach (ACC_CUCCheck cucCheck in cucChecks) { if (temp == cucCheck.PaytoHeadID) { //cucCheck.PaytoHeadID = eachJournal.JournalID; cucCheck.JournalID = eachJournal.JournalID; ACC_CUCCheckManager.InsertACC_CUCCheck(cucCheck); } } } } } if (Session["cucCheck"] != null) Session.Remove("cucCheck"); if (Session["doubleEntry"] != null) Session.Remove("doubleEntry"); if (Session["checks"] != null) Session.Remove("checks"); try { if (Request.QueryString["CheckID"] != null) { ACC_Check aCC_Check = new ACC_Check(); aCC_Check = ACC_CheckManager.GetACC_CheckByCheckID(int.Parse(Request.QueryString["CheckID"])); aCC_Check.UpdatedBy = Profile.card_id; aCC_Check.UpdateDate = DateTime.Now; aCC_Check.RowStatusID = 11; bool resutl = ACC_CheckManager.UpdateACC_Check(aCC_Check); } } catch (Exception ex) { } try { if (Request.QueryString["EmployPayRoleSalaryID"] != null) { ACC_EmployPayRoleSalary employPayroleSalary = new ACC_EmployPayRoleSalary(); if (Session["employPayRoleSalary"] != null) { employPayroleSalary = (ACC_EmployPayRoleSalary)Session["employPayRoleSalary"]; employPayroleSalary.ExtraField6 += ", " + aCC_JournalMaster.JournalMasterID.ToString(); employPayroleSalary.ExtraField7 = fulltimesalryJournalID.ToString(); } Session.Remove("employPayRoleSalary"); bool result = ACC_EmployPayRoleSalaryManager.UpdateEmployPayRoleSalary(employPayroleSalary); } } catch (Exception ex) { } try { if (Request.QueryString["FeesID"] != null) { STD_Fees sTD_FeesUpdate = new STD_Fees(); sTD_FeesUpdate = STD_FeesManager.GetSTD_FeesByFeesID(int.Parse(Request.QueryString["FeesID"])); sTD_FeesUpdate.IsPaid = true; sTD_FeesUpdate.SubmitedDate = DateTime.Today.ToString(); sTD_FeesUpdate.UpdatedBy = Profile.card_id; sTD_FeesUpdate.UpdateDate = DateTime.Now; sTD_FeesUpdate.RowStatusID = int.Parse("1"); sTD_FeesUpdate.Remarks = Request.QueryString["Remarks"]; bool resutl = STD_FeesManager.UpdateSTD_Fees(sTD_FeesUpdate); STD_FeesMaster feesMaster = new STD_FeesMaster(); feesMaster = STD_FeesMasterManager.GetSTD_FeesMasterByFeesMasterID(int.Parse(sTD_FeesUpdate.FeesName)); feesMaster.ExtraField1 = (decimal.Parse(feesMaster.ExtraField1) + sTD_FeesUpdate.Amount).ToString();//total paid Amount feesMaster.ExtraField1 = (decimal.Parse(feesMaster.ExtraField2) - sTD_FeesUpdate.Amount).ToString();//total unpaid Amount resutl = STD_FeesMasterManager.UpdateSTD_FeesMaster(feesMaster); } } catch (Exception ex) { } STD_FeesMaster feesMasterTemp = new STD_FeesMaster(); try { if (Request.QueryString["newFeesID"] != null) { if (Session["feesListUpdate"] != null) { List<STD_Fees> feesListUpdate = new List<STD_Fees>(); feesListUpdate = (List<STD_Fees>)Session["feesListUpdate"]; foreach (STD_Fees item in feesListUpdate) { item.IsPaid = true; STD_FeesManager.UpdateSTD_Fees(item); } Session.Remove("feesListUpdate"); } if (Session["feesMaster"] != null) { feesMasterTemp = (STD_FeesMaster)Session["feesMaster"]; feesMasterTemp.ExtraField4 = FeesMasterJournalID.ToString(); STD_FeesMasterManager.UpdateSTD_FeesMaster(feesMasterTemp); Session.Remove("feesMaster"); } if (Request.QueryString["newFeesID"] != "0") { STD_Fees sTD_FeesUpdate = new STD_Fees(); sTD_FeesUpdate = STD_FeesManager.GetSTD_FeesByFeesID(int.Parse(Request.QueryString["newFeesID"])); sTD_FeesUpdate.RowStatusID = int.Parse("1"); bool resutl = STD_FeesManager.UpdateSTD_Fees(sTD_FeesUpdate); } } } catch (Exception ex) { } if (Request.QueryString["Refund"] != null) { if (STD_FeesMasterManager.RefundSTD_FeesMaster(hfStudentID.Value)) { lblMessage.Text += "Student Refund Successfull<br/>"; } } lblMessage.Text += "Journal Entry Successful. <a href='VoucherPage.aspx?JournalMasterID=" + aCC_JournalMaster.JournalMasterID.ToString() + "&EmployeeID=" + ddlAccountingUserMoney.SelectedValue + "&Amount=" + lblDebit.Text + "' target='_blank'>Click here to Print</a>"; if (Request.QueryString["AccountID"] != null) { //if (int.Parse(Request.QueryString["AccountID"]) >= 29 && int.Parse(Request.QueryString["AccountID"]) <= 37) if (int.Parse(Request.QueryString["SubBasicAccountID"]) ==20) { lblMessage.Text += "</br><a target='_blank' href='FeesInstallment.aspx?StudentCode=" + Request.QueryString["StudentCode"] + "'>Back to Student Fees Search page</a></br><a href='MoneyReceipt.aspx?StudentID=" + hfStudentID.Value + "&Amount=" + lblDebit.Text + "&Remark=" + (chkAddInMoneyReceipt.Checked ? txtRemarks.Text : "") + "&FeesMasterID=" + feesMasterTemp.FeesMasterID.ToString() + "&JournalMasterID=" + aCC_JournalMaster.JournalMasterID.ToString() + "&IsAdmissionFees=" + Request.QueryString["IsAdmissionFees"] + "' target='_blank'>Click here to Print the receipt</a>"; //lblMessage.Text += "</br><a target='_blank' href='FeesInstallment.aspx?StudentCode=" + Request.QueryString["StudentCode"] + "'>Back to Student Fees Search page</a></br><a href='../Accounting/MoneyReceipt.aspx?StudentID=" + hfStudentID.Value + "&Amount=" + lblDebit.Text + "&Remark=" + Request.QueryString["Remark"] + "&FeesMasterID=" + feesMasterTemp.FeesMasterID.ToString() + "&JournalMasterID=" + aCC_JournalMaster.JournalMasterID.ToString() + "' target='_blank'>Click here to Print the receipt</a>"; } else if (int.Parse(Request.QueryString["AccountID"]) >= 17 && int.Parse(Request.QueryString["AccountID"]) <= 19) { lblMessage.Text += "</br><a target='_blank' href='AccountEmployPayRoleSalary.aspx?EmployeeID=" + Request.QueryString["EmployeeID"] + "'>Back to Sallary posting page</a></br><a href='VoucherPage.aspx?JournalMasterID=" + aCC_JournalMaster.JournalMasterID.ToString() + "&EmployeeID=" + ddlAccountingUser.SelectedValue + "&Amount=" + lblDebit.Text + "&Payto=" + ddlAccountingUser.SelectedItem.Text + "&Purpose=" + Request.QueryString["Purpose"] + "' target='_blank'>Click here to Print the receipt</a>"; } } lblMessage.ForeColor = System.Drawing.Color.Green; btnJournalEntry.Visible = false; }
public bool UpdateACC_JournalMaster(ACC_JournalMaster aCC_JournalMaster) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("UpdateACC_JournalMaster", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@JournalMasterID", SqlDbType.Int).Value = aCC_JournalMaster.JournalMasterID; cmd.Parameters.Add("@JournalMasterName", SqlDbType.NVarChar).Value = aCC_JournalMaster.JournalMasterName; cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar).Value = aCC_JournalMaster.UpdatedBy; cmd.Parameters.Add("@UpdateDate", SqlDbType.DateTime).Value = aCC_JournalMaster.UpdateDate.AddHours(double.Parse(ConfigurationManager.AppSettings["ServerTimeDiff"].ToString())); cmd.Parameters.Add("@RowStatusID", SqlDbType.Int).Value = aCC_JournalMaster.RowStatusID; connection.Open(); int result = cmd.ExecuteNonQuery(); return result == 1; } }
private void loadData() { try { ACC_JournalMaster journalMaster = ACC_JournalMasterManager.GetACC_JournalMasterByID(int.Parse(Request.QueryString["JournalMasterID"])); List <ACC_JournalDetail> journalDetails = ACC_JournalDetailManager.GetAllACC_JournalDetailByJournalMasterID(int.Parse(Request.QueryString["JournalMasterID"])); string journalDetailsHTML = @"<table id='tblJournalDetails' class='tdBorder' border='0' cellspacing='0' cellpadding='0' style='margin:20px 0;'> <tr style='font-weight:bold;font-size:15px;'> <td width='100px'> Account Code </td> <td width='487px'> Account Title </td> <td width='80px'> Debit </td> <td width='80px'> Credit </td> </tr>"; decimal totalDebit = 0; decimal totalCredit = 0; trAddress.Visible = false; trCheck.Visible = false; bool defaultJournal = false; switch (journalMaster.JournalMasterName) { case "1": //Receipt Voucher lblVoucherName.Text = "RECEIPT"; lblVoucherType.Text = "RV"; lblReceivedfromOrPayto.Text = "Received from"; trAddress.Visible = true; trCheck.Visible = true; //generate table foreach (ACC_JournalDetail journalDetail in journalDetails) { try { if (journalDetail.Credit == 0) { journalDetailsHTML += @"<tr> <td> " + journalDetail.ACC_ChartOfAccountLabel3Code + @" </td> <td> " + journalDetail.ACC_ChartOfAccountLabel3Text + " - " + journalDetail.ACC_ChartOfAccountLabel4Text + " (" + journalDetail.WorkStationName + @") </td> <td style='text-align:right;'> " + journalDetail.Debit.ToString("0,0.000000") + @" </td> <td style='text-align:right;'> " + journalDetail.Credit.ToString("0,0.000000") + @" </td> </tr>"; totalCredit += journalDetail.Credit; totalDebit += journalDetail.Debit; } } catch (Exception ex) { } } foreach (ACC_JournalDetail journalDetail in journalDetails) { try { if (journalDetail.Credit != 0) { journalDetailsHTML += @"<tr> <td> " + journalDetail.ACC_ChartOfAccountLabel3Code + @" </td> <td> " + journalDetail.ACC_ChartOfAccountLabel3Text + " - " + journalDetail.ACC_ChartOfAccountLabel4Text + " (" + journalDetail.WorkStationName + @") </td> <td style='text-align:right;'> " + journalDetail.Debit.ToString("0,0.000000") + @" </td> <td style='text-align:right;'> " + journalDetail.Credit.ToString("0,0.000000") + @" </td> </tr>"; totalCredit += journalDetail.Credit; totalDebit += journalDetail.Debit; } } catch (Exception ex) { } } foreach (ACC_JournalDetail journalDetail in journalDetails) { if (journalDetail.Credit == 0) { lblChequeDate.Text = journalDetail.ExtraField1; lblChequeNo.Text = journalDetail.ExtraField3; try { lblChequeBank.Text = journalDetail.ExtraField2.Split(',')[1]; } catch (Exception ex) { } try { lblChequeBranch.Text = journalDetail.ExtraField2.Split(',')[0]; } catch (Exception ex) { } break; } } lblJournalDetials.Text = journalDetailsHTML + "<tr><td></td><td><b>Total:</b></td><td style='text-align:right;'>" + totalDebit.ToString("0,0.000000") + "</td><td style='text-align:right;'>" + totalCredit.ToString("0,0.000000") + "</td></tr><tr><td colspan='4'><b>Taka in words:</b> " + NumberToWords(int.Parse(totalCredit.ToString("0"))) + " taka only.</td></tr></table>"; break; case "2": //Payment Voucher lblVoucherName.Text = "PAYMENT"; lblVoucherType.Text = "PV"; lblReceivedfromOrPayto.Text = "Pay To"; trAddress.Visible = true; trCheck.Visible = true; //generate table foreach (ACC_JournalDetail journalDetail in journalDetails) { try { if (journalDetail.Credit == 0) { journalDetailsHTML += @"<tr> <td> " + journalDetail.ACC_ChartOfAccountLabel3Code + @" </td> <td> " + journalDetail.ACC_ChartOfAccountLabel3Text + " - " + journalDetail.ACC_ChartOfAccountLabel4Text + " (" + journalDetail.WorkStationName + @") </td> <td style='text-align:right;'> " + journalDetail.Debit.ToString("0,0.000000") + @" </td> <td style='text-align:right;'> " + journalDetail.Credit.ToString("0,0.000000") + @" </td> </tr>"; totalCredit += journalDetail.Credit; totalDebit += journalDetail.Debit; } } catch (Exception ex) { } } foreach (ACC_JournalDetail journalDetail in journalDetails) { try { if (journalDetail.Credit != 0) { journalDetailsHTML += @"<tr> <td> " + journalDetail.ACC_ChartOfAccountLabel3Code + @" </td> <td> " + journalDetail.ACC_ChartOfAccountLabel3Text + " - " + journalDetail.ACC_ChartOfAccountLabel4Text + " (" + journalDetail.WorkStationName + @") </td> <td style='text-align:right;'> " + journalDetail.Debit.ToString("0,0.000000") + @" </td> <td style='text-align:right;'> " + journalDetail.Credit.ToString("0,0.000000") + @" </td> </tr>"; totalCredit += journalDetail.Credit; totalDebit += journalDetail.Debit; } } catch (Exception ex) { } } foreach (ACC_JournalDetail journalDetail in journalDetails) { if (journalDetail.Debit == 0) { lblChequeDate.Text = journalDetail.ExtraField1; lblChequeNo.Text = journalDetail.ExtraField3; try { lblChequeBank.Text = journalDetail.ExtraField2.Split(',')[1]; } catch (Exception ex) { } try { lblChequeBranch.Text = journalDetail.ExtraField2.Split(',')[0]; } catch (Exception ex) { } break; } } lblJournalDetials.Text = journalDetailsHTML + "<tr><td></td><td><b>Total:</b></td><td style='text-align:right;'>" + totalDebit.ToString("0,0.000000") + "</td><td style='text-align:right;'>" + totalCredit.ToString("0,0.000000") + "</td></tr><tr><td colspan='4'><b>Taka in words:</b> " + NumberToWords(int.Parse(totalDebit.ToString("0"))) + " taka only.</td></tr></table>"; break; case "3": //Journal Voucher lblVoucherName.Text = "JOURNAL"; lblVoucherType.Text = "JV"; defaultJournal = true; break; case "4": //Contra Voucher lblVoucherName.Text = "CONTRA"; lblVoucherType.Text = "CV"; trCheck.Visible = true; defaultJournal = true; foreach (ACC_JournalDetail journalDetail in journalDetails) { if (journalDetail.ExtraField3 != "") { lblChequeDate.Text = journalDetail.ExtraField1; lblChequeNo.Text = journalDetail.ExtraField3; try { lblChequeBank.Text = journalDetail.ExtraField2.Split(',')[1]; } catch (Exception ex) { } try { lblChequeBranch.Text = journalDetail.ExtraField2.Split(',')[0]; } catch (Exception ex) { } break; } } break; default: break; } if (defaultJournal) { foreach (ACC_JournalDetail journalDetail in journalDetails) { try { journalDetailsHTML += @"<tr> <td> " + journalDetail.ACC_ChartOfAccountLabel3Code + @" </td> <td> " + journalDetail.ACC_ChartOfAccountLabel3Text + " - " + journalDetail.ACC_ChartOfAccountLabel4Text + " (" + journalDetail.WorkStationName + @") </td> <td style='text-align:right;'> " + journalDetail.Debit.ToString("0,0.000000") + @" </td> <td style='text-align:right;'> " + journalDetail.Credit.ToString("0,0.000000") + @" </td> </tr>"; totalCredit += journalDetail.Credit; totalDebit += journalDetail.Debit; } catch (Exception ex) { } } lblJournalDetials.Text = journalDetailsHTML + "<tr><td></td><td><b>Total:</b></td><td style='text-align:right;'>" + totalDebit.ToString("0,0.000000") + "</td><td style='text-align:right;'>" + totalCredit.ToString("0,0.000000") + "</td></tr><tr><td colspan='4'><b>Taka in words:</b> " + NumberToWords(int.Parse(totalCredit.ToString("0"))) + " taka only.</td></tr></table>"; } lblOfficeName.Text = journalDetails[0].WorkStationName; lblJournalMasterID.Text = Request.QueryString["JournalMasterID"]; if (journalMaster.RowStatusID != 1) { lblJournalMasterID.BackColor = System.Drawing.Color.Red; } lblDate.Text = journalMaster.JournalDate.ToString("dd MMM yyyy"); lblCustomerName.Text = journalMaster.ExtraField1; lblAddress.Text = journalMaster.ExtraField2; if (journalMaster.Note.Contains("Inventory Purchase-")) { lblExplanation.Text = "<a href='../Inventory/PurchasePrint.aspx?PurchaseID=" + journalMaster.Note.Replace("Inventory Purchase-", "") + "' target='_blank'>" + journalMaster.Note + "</a>"; } else { lblExplanation.Text = journalMaster.Note; } } catch (Exception ex) { } }
protected void btnJournalSubmit_Click(object sender, EventArgs e) { List <ACC_HeadType> allACC_HeadType = ACC_HeadTypeManager.GetAllACC_HeadTypes(); ACC_JournalMaster aCC_JournalMaster = new ACC_JournalMaster(); aCC_JournalMaster.JournalMasterName = "4";//Contra aCC_JournalMaster.ExtraField1 = ""; aCC_JournalMaster.ExtraField2 = ""; aCC_JournalMaster.ExtraField3 = ""; aCC_JournalMaster.Note = ""; aCC_JournalMaster.JournalDate = DateTime.Parse(txtJournalDate.Text); aCC_JournalMaster.AddedBy = getLogin().LoginID; aCC_JournalMaster.AddedDate = DateTime.Now; aCC_JournalMaster.UpdatedBy = getLogin().LoginID; aCC_JournalMaster.UpdatedDate = DateTime.Now; aCC_JournalMaster.RowStatusID = 1; int JournalMasterID = 0; JournalMasterID = ACC_JournalMasterManager.InsertACC_JournalMaster(aCC_JournalMaster); foreach (GridViewRow gvr in gvACC_ChartOfAccountLabel4.Rows) { HiddenField hfChartOfAccountLabel4ID = (HiddenField)gvr.FindControl("hfChartOfAccountLabel4ID"); DropDownList ddlBanks = (DropDownList)gvr.FindControl("ddlBanks"); DropDownList ddlSupplier = (DropDownList)gvr.FindControl("ddlSupplier"); Label lblChartOfAccountLabel4Text = (Label)gvr.FindControl("lblChartOfAccountLabel4Text"); TextBox txtOpiningBalance = (TextBox)gvr.FindControl("txtOpiningBalance"); TextBox txtCheckDate = (TextBox)gvr.FindControl("txtCheckDate"); TextBox txtCashWithdraw = (TextBox)gvr.FindControl("txtCashWithdraw"); TextBox txtSypplyerPayment = (TextBox)gvr.FindControl("txtSypplyerPayment"); TextBox txtCheckNo = (TextBox)gvr.FindControl("txtCheckNo"); TextBox txtFundTransfer = (TextBox)gvr.FindControl("txtFundTransfer"); TextBox txtDiscountIncome = (TextBox)gvr.FindControl("txtDiscountIncome"); try { ACC_JournalDetail aCC_JournalDetail = new ACC_JournalDetail(); aCC_JournalDetail.JournalMasterID = JournalMasterID; aCC_JournalDetail.ExtraField3 = ""; aCC_JournalDetail.ExtraField2 = ""; aCC_JournalDetail.ExtraField1 = ""; aCC_JournalDetail.AddedBy = getLogin().LoginID; aCC_JournalDetail.AddedDate = DateTime.Now; aCC_JournalDetail.UpdatedBy = getLogin().LoginID; aCC_JournalDetail.UpdatedDate = DateTime.Now; aCC_JournalDetail.RowStatusID = 1; aCC_JournalDetail.WorkStation = 1; aCC_JournalDetail.WorkStationName = "Heand Office"; //For fund transfer To Bank if (txtFundTransfer.Text != "0" && ddlBanks.SelectedValue != "0") { aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = Int32.Parse(ddlBanks.SelectedValue); } aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = ddlBanks.SelectedItem.Text; aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Cash at Bank"; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 3; aCC_JournalDetail.Debit = Decimal.Parse(txtFundTransfer.Text); aCC_JournalDetail.Credit = Decimal.Parse("0"); if (txtFundTransfer.Text != "0" && ddlBanks.SelectedValue != "0") { ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); } //For fund transfer From Bank aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = Int32.Parse(hfChartOfAccountLabel4ID.Value); aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = lblChartOfAccountLabel4Text.Text; aCC_JournalDetail.Credit = Decimal.Parse(txtFundTransfer.Text); aCC_JournalDetail.Debit = Decimal.Parse("0"); if (txtFundTransfer.Text != "0" && ddlBanks.SelectedValue != "0") { ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); } //Cash Withdrawal for Bank aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Cash at Bank"; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 3; aCC_JournalDetail.Credit = Decimal.Parse(txtCashWithdraw.Text); aCC_JournalDetail.Debit = Decimal.Parse("0"); if (txtCashWithdraw.Text != "0") { ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); } //Cash Withdrawal for Head OFfcie aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = 1; aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = "Head Office"; aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Cash in hand"; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 1; aCC_JournalDetail.Debit = Decimal.Parse(txtCashWithdraw.Text); aCC_JournalDetail.Credit = 0; if (txtCashWithdraw.Text != "0") { ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); } //Supplier Payment for Bank aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = Int32.Parse(hfChartOfAccountLabel4ID.Value); aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = lblChartOfAccountLabel4Text.Text; aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Cash at Bank"; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 3; aCC_JournalDetail.Credit = Decimal.Parse(txtSypplyerPayment.Text); aCC_JournalDetail.Debit = Decimal.Parse("0"); if (txtSypplyerPayment.Text != "0" && ddlSupplier.SelectedValue != "0") { ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); } //Supplier Payment for Suppliyer if (txtSypplyerPayment.Text != "0" && ddlSupplier.SelectedValue != "0") { aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = Int32.Parse(ddlSupplier.SelectedValue); } aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = ddlSupplier.SelectedItem.Text; aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Suppliyer payable"; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 43; aCC_JournalDetail.Debit = Decimal.Parse(txtSypplyerPayment.Text); aCC_JournalDetail.Credit = Decimal.Parse("0"); if (txtSypplyerPayment.Text != "0" && ddlSupplier.SelectedValue != "0") { ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); } //Cash discount supplier payable aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = Int32.Parse(ddlSupplier.SelectedValue); aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = ddlSupplier.SelectedItem.Text; aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Suppliyer payable"; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 43; aCC_JournalDetail.Debit = Decimal.Parse(txtDiscountIncome.Text); aCC_JournalDetail.Credit = Decimal.Parse("0"); if (txtDiscountIncome.Text != "0" && txtDiscountIncome.Text != "") { ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); } //Cash discount for Income aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = Int32.Parse(ddlSupplier.SelectedValue); aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = ddlSupplier.SelectedItem.Text; aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Cash Discount from Supplier"; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 211; aCC_JournalDetail.Credit = Decimal.Parse(txtDiscountIncome.Text); aCC_JournalDetail.Debit = Decimal.Parse("0"); if (txtDiscountIncome.Text != "0" && txtDiscountIncome.Text != "") { ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); } } catch (Exception ex) { } } hlnkPrintVoucher.Visible = true; hlnkPrintVoucher.NavigateUrl = "Voucherprint.aspx?JournalMasterID=" + JournalMasterID; }
public static int InsertACC_JournalMasterTmp(ACC_JournalMaster aCC_JournalMaster) { SqlACC_JournalMasterProvider sqlACC_JournalMasterProvider = new SqlACC_JournalMasterProvider(); return sqlACC_JournalMasterProvider.InsertACC_JournalMasterTmp(aCC_JournalMaster); }
protected void btnAdd_Click(object sender, EventArgs e) { if (!checking()) { return; } Inv_IssueMaster inv_IssueMaster = new Inv_IssueMaster(); inv_IssueMaster.IssueName = ""; inv_IssueMaster.IssueDate = DateTime.Parse(txtIssueDate.Text); inv_IssueMaster.EmployeeID = Int32.Parse(ddlEmployee.SelectedValue); inv_IssueMaster.WorkSatationID = Int32.Parse(ddlWorkSatation.SelectedValue); inv_IssueMaster.Particulars = txtParticulars.Text; inv_IssueMaster.IsIssue = (Request.QueryString["IsNonProduction"] != null ? false : true); inv_IssueMaster.ExtraField1 = ""; inv_IssueMaster.ExtraField2 = ""; inv_IssueMaster.ExtraField3 = ""; inv_IssueMaster.ExtraField4 = ""; inv_IssueMaster.ExtraField5 = ""; inv_IssueMaster.AddedBy = getLogin().LoginID; inv_IssueMaster.AddedDate = DateTime.Now; inv_IssueMaster.UpdatedBy = getLogin().LoginID; inv_IssueMaster.UpdatedDate = DateTime.Now; inv_IssueMaster.RowStatusID = 1; if (txtOldIssueID.Text == "") { inv_IssueMaster.Inv_IssueMasterID = Inv_IssueMasterManager.InsertInv_IssueMaster(inv_IssueMaster); } else { inv_IssueMaster.Inv_IssueMasterID = int.Parse(txtOldIssueID.Text); } int JournalMasterID = 0; foreach (GridViewRow gvr in gvInv_Item.Rows) { HiddenField hfInv_ItemID = (HiddenField)gvr.FindControl("hfInv_ItemID"); Label lblPurchaseID = (Label)gvr.FindControl("lblPurchaseID"); TextBox txtIssueQuantity = (TextBox)gvr.FindControl("txtIssueQuantity"); TextBox txtApproximateQuantity = (TextBox)gvr.FindControl("txtApproximateQuantity"); DropDownList ddlProduct = (DropDownList)gvr.FindControl("ddlProduct"); HiddenField hfRawMaterialTypeID = (HiddenField)gvr.FindControl("hfRawMaterialTypeID"); if (hfRawMaterialTypeID.Value == "10" && JournalMasterID == 0) { if (ddlWorkSatation.SelectedValue != "1") { //Journal Entry ACC_JournalMaster aCC_JournalMaster = new ACC_JournalMaster(); aCC_JournalMaster.JournalMasterName = "3";//Journal Voucher aCC_JournalMaster.ExtraField1 = ddlWorkSatation.SelectedItem.Text; aCC_JournalMaster.ExtraField2 = ""; aCC_JournalMaster.ExtraField3 = ""; aCC_JournalMaster.Note = "Inventory Issue-" + inv_IssueMaster.Inv_IssueMasterID.ToString(); aCC_JournalMaster.JournalDate = DateTime.Parse(txtIssueDate.Text); aCC_JournalMaster.AddedBy = getLogin().LoginID; aCC_JournalMaster.AddedDate = DateTime.Now; aCC_JournalMaster.UpdatedBy = getLogin().LoginID; aCC_JournalMaster.UpdatedDate = DateTime.Now; aCC_JournalMaster.RowStatusID = 1; JournalMasterID = ACC_JournalMasterManager.InsertACC_JournalMaster(aCC_JournalMaster); } } Label lblAvailableQuantity = (Label)gvr.FindControl("lblExtraFieldQuantity1"); if (txtIssueQuantity.Text != "0" && txtIssueQuantity.Text != "") { Inv_IssueDetail inv_IssueDetail = new Inv_IssueDetail(); inv_IssueDetail.ItemID = Int32.Parse(hfInv_ItemID.Value); inv_IssueDetail.Quantity = Decimal.Parse(txtIssueQuantity.Text); inv_IssueDetail.ProductID = Int32.Parse(ddlProduct.SelectedValue); inv_IssueDetail.AdditionalWithIssueDetailID = 0; inv_IssueDetail.ApproximateQuantity = Int32.Parse(txtApproximateQuantity.Text); inv_IssueDetail.ExtraField1 = txtIssueQuantity.Text; inv_IssueDetail.ExtraField2 = "0"; inv_IssueDetail.ExtraField3 = "0"; inv_IssueDetail.ExtraField4 = (hfRawMaterialTypeID.Value == "10"?JournalMasterID.ToString():"0"); inv_IssueDetail.ExtraField5 = inv_IssueMaster.Inv_IssueMasterID.ToString(); inv_IssueDetail.AddedBy = getLogin().LoginID; inv_IssueDetail.AddedDate = DateTime.Now; inv_IssueDetail.UpdatedBy = getLogin().LoginID; inv_IssueDetail.UpdatedDate = DateTime.Now; inv_IssueDetail.RowStatusID = 1; if (Inv_IssueDetailManager.InsertInv_IssueDetail(inv_IssueDetail) <= 0) { showAlartMessage("Double Pressed"); return; } } } hlnkIssuePrint.NavigateUrl = "IssuePrint.aspx?IssueID=" + inv_IssueMaster.Inv_IssueMasterID.ToString(); hlnkIssuePrint.Visible = true; showInv_IssueDetailGrid(); }
protected void btnSubmit_Click(object sender, EventArgs e) { if (ddlSuppier.SelectedValue == "0") { showAlartMessage("Please select the Supplier"); return; } List<Inv_Item> PurchasedItems = new List<Inv_Item>(); PurchasedItems = loadFromTheGrid(); if (PurchasedItems.Count == 0) { showAlartMessage("Please Add Items"); return; } int JournalMasterID = 0; int pruchseID = 0; if (txtOldPurchaseID.Text == "") { //Insert Purchse Inv_Purchase inv_Purchase = new Inv_Purchase(); inv_Purchase.PurchaseName = ""; inv_Purchase.PurchseDate = DateTime.Parse(txtPurchseDate.Text); inv_Purchase.SuppierID = Int32.Parse(ddlSuppier.SelectedValue); inv_Purchase.InvoiceNo = txtInvoiceNo.Text; inv_Purchase.Particulars = txtParticulars.Text; inv_Purchase.IsPurchase = true; inv_Purchase.WorkSatationID = 2;//Int32.Parse(ddlWorkSatation.SelectedValue); inv_Purchase.ExtraField1 = rbtnlRawmaterialsType.SelectedValue; inv_Purchase.ExtraField2 = ""; inv_Purchase.ExtraField3 = rbtnlPaymentType.SelectedValue; inv_Purchase.ExtraField4 = ""; inv_Purchase.ExtraField5 = ""; inv_Purchase.AddedBy = getLogin().LoginID; inv_Purchase.AddedDate = DateTime.Now; inv_Purchase.UpdatedBy = getLogin().LoginID; inv_Purchase.UpdatedDate = DateTime.Now; inv_Purchase.RowStatusID = 1; pruchseID = Inv_PurchaseManager.InsertInv_Purchase(inv_Purchase); //Journal Entry ACC_JournalMaster aCC_JournalMaster = new ACC_JournalMaster(); aCC_JournalMaster.JournalMasterName = (rbtnlPaymentType.SelectedValue == "Cash" ? "2" : "3");//Journal Voucher aCC_JournalMaster.ExtraField1 = ddlSuppier.SelectedItem.Text; aCC_JournalMaster.ExtraField2 = ""; aCC_JournalMaster.ExtraField3 = ""; aCC_JournalMaster.Note = "Inventory Purchase-" + pruchseID.ToString(); aCC_JournalMaster.JournalDate = DateTime.Parse(txtPurchseDate.Text); aCC_JournalMaster.AddedBy = getLogin().LoginID; aCC_JournalMaster.AddedDate = DateTime.Now; aCC_JournalMaster.UpdatedBy = getLogin().LoginID; aCC_JournalMaster.UpdatedDate = DateTime.Now; aCC_JournalMaster.RowStatusID = 1; JournalMasterID = ACC_JournalMasterManager.InsertACC_JournalMaster(aCC_JournalMaster); //insert each Item CommonManager.SQLExec("Update Inv_Purchase set ExtraField2='" + JournalMasterID.ToString() + "' where Inv_PurchaseID=" + pruchseID.ToString() + "; select 1"); } else { string SQL = "select ACC_JournalMasterID from ACC_JournalMaster where Note='Inventory Purchase-"+txtOldPurchaseID.Text+"'"; try { JournalMasterID = int.Parse(CommonManager.SQLExec(SQL).Tables[0].Rows[0][0].ToString()); pruchseID = int.Parse(txtOldPurchaseID.Text); } catch (Exception ex) { showAlartMessage("Wrong Old PurchaseID"); return; } } foreach (Inv_Item item in PurchasedItems) { item.PurchaseID = pruchseID; item.UpdatedBy = JournalMasterID;//emporary we pass the journal master ID item.ExtraField6 = rbtnlPaymentType.SelectedValue; item.Inv_ItemID= Inv_ItemManager.InsertInv_Item(item); } PurchasedItems = new List<Inv_Item>(); showInv_ItemGrid(PurchasedItems); hlnkPurchasePrint.NavigateUrl = "PurchasePrint.aspx?PurchaseID=" + pruchseID.ToString(); hlnkPurchasePrint.Visible = true; }
protected void btnJournalEntry_Click(object sender, EventArgs e) { if (Request.QueryString["ID"] != null) { #region Update preentry process HR_Employee employee = new HR_Employee(); employee.EmployeeID = Convert.ToString(Request.QueryString["ID"]); employee.ResignDescription = txtResignDescription.Text.Trim(); employee.ResignDate = Convert.ToDateTime(txtResignDate.Text.Trim()); employee.Flag = false; string userID = Profile.card_id; employee.ModifiedBy = userID; employee.ModifiedDate = DateTime.Now; HR_ProvidentFundRegister providentFundRegister = new HR_ProvidentFundRegister(); if (lblEmpPortionFund.Text.Trim() != string.Empty) { providentFundRegister.EmployeeID = Convert.ToString(Request.QueryString["ID"]); providentFundRegister.PayrollMonthDate = DateTime.Now; providentFundRegister.WithdrawAmount = Convert.ToDecimal(lblEmpPortionFund.Text.Trim()); providentFundRegister.WithdrawLastDate = DateTime.Now; providentFundRegister.AddedBy = userID; providentFundRegister.AddedDate = DateTime.Now; } bool isUpdate = HR_EmployeeManager.UpdateHR_EmployeeResignInfo(employee); if (isUpdate) { if (providentFundRegister.EmployeeID != string.Empty) { HR_ProvidentFundRegisterManager.InsertHR_ProvidentFundRegisterWithdrawAmount(providentFundRegister); } lblMessage.Text = "Information is saved successfully"; lblMessage.ForeColor = System.Drawing.Color.Green; } if (Convert.ToDecimal(txtRemainingSalary.Text) > 0) { ACC_EmployPayRoleSalary paySalary = new ACC_EmployPayRoleSalary(); paySalary.AddedBy = userID; paySalary.AddedDate = DateTime.Now; paySalary.UpdatedBy = userID; paySalary.UpdatedDate = DateTime.Now; paySalary.EmployeeID = Request.QueryString["ID"]; paySalary.SalaryAmount = Convert.ToDecimal(txtRemainingSalary.Text); paySalary.PaidSalaryAmount = Convert.ToDecimal("0"); paySalary.UnpaidSalaryAmount = Convert.ToDecimal(txtRemainingSalary.Text); paySalary.Status = 35; paySalary.RowStatusID = 1; paySalary.SalaryOfDate = DateTime.Parse(txtResignDate.Text).ToString("MMMM, yyyy"); paySalary.ExtraField1 = lblSalaryBreakDown.Text; paySalary.ExtraField2 = paySalary.SalaryAmount.ToString("00"); paySalary.ExtraField3 = string.Empty; paySalary.ExtraField4 = string.Empty; paySalary.ExtraField5 = string.Empty; paySalary.ExtraField6 = string.Empty; paySalary.ExtraField7 = string.Empty; paySalary.ExtraField8 = string.Empty; paySalary.ExtraField9 = string.Empty; paySalary.ExtraField10 = string.Empty; int insertedID = ACC_EmployPayRoleSalaryManager.InsertEmployPayRoleSalary(paySalary); } #endregion #region Journal entry List<ACC_Journal> doubleEntry = new List<ACC_Journal>(); doubleEntry = (List<ACC_Journal>)Session["doubleEntry"]; List<ACC_CUCCheck> cucChecks = new List<ACC_CUCCheck>(); if (Session["cucCheck"] != null) cucChecks = (List<ACC_CUCCheck>)Session["cucCheck"]; ACC_JournalMaster aCC_JournalMaster = new ACC_JournalMaster(); aCC_JournalMaster.JournalMasterName = ""; aCC_JournalMaster.AddedBy = Profile.card_id; aCC_JournalMaster.AddedDate = DateTime.Now; aCC_JournalMaster.UpdatedBy = Profile.card_id; aCC_JournalMaster.UpdateDate = DateTime.Now; aCC_JournalMaster.RowStatusID = 1; aCC_JournalMaster.JournalMasterID = ACC_JournalMasterManager.InsertACC_JournalMaster(aCC_JournalMaster); if (doubleEntry != null) { foreach (ACC_Journal eachJournal in doubleEntry) { int temp = eachJournal.JournalID; string checkno = eachJournal.JournalVoucherNo; eachJournal.JournalVoucherNo = ""; eachJournal.JournalMasterID = aCC_JournalMaster.JournalMasterID; eachJournal.JournalID = ACC_JournalManager.InsertACC_Journal(eachJournal); foreach (ACC_CUCCheck cucCheck in cucChecks) { if (temp == cucCheck.PaytoHeadID) { cucCheck.PaytoHeadID = eachJournal.JournalID; ACC_CUCCheckManager.InsertACC_CUCCheck(cucCheck); } } } } if (Session["cucCheck"] != null) Session.Remove("cucCheck"); if (Session["doubleEntry"] != null) Session.Remove("doubleEntry"); #endregion /* * <option value="46">Employee Provident Fund</option> * <option value="47" selected="selected">Company Provident Fund</option> * <option value="3" selected="selected">Advance Salary</option> * <option value="17" selected="selected">Employee(Fulltime) Salary</option> * <option value="49" selected="selected">Allowance (Provident Fund)</option> */ decimal advanceSalaryAmount = decimal.Parse(txtAdvanceSalary.Text); decimal salaryOfthisMonth = decimal.Parse(txtSalaryOfThisMonth.Text); decimal totalJournalEntryMoney = decimal.Parse(txtFinalAmountToWithDraw.Text); decimal EPFMoney = decimal.Parse(txtEmpContributionAmount.Text); decimal CPFMoney =decimal.Parse(lblEmpPortionFund.Text) - decimal.Parse(txtEmpContributionAmount.Text); //CPF need to process //Refund CPF if (decimal.Parse(lblReturnFundToCompany.Text) > 0) { processRefundCPF(decimal.Parse(lblReturnFundToCompany.Text)); } #region Advance Salary process //advance salary deduction form the fulltime salary if (advanceSalaryAmount > 0) { if (salaryOfthisMonth > 0) { if (advanceSalaryAmount <= salaryOfthisMonth) { processAdvanceSalary(advanceSalaryAmount); advanceSalaryAmount = 0; salaryOfthisMonth -= advanceSalaryAmount; } else { processAdvanceSalary(salaryOfthisMonth); salaryOfthisMonth = 0; advanceSalaryAmount -= salaryOfthisMonth; } } } //remaining salary deduction from the Employee Provident fund contribution if (advanceSalaryAmount > 0) { if (EPFMoney > 0) { if (advanceSalaryAmount <= EPFMoney) { processAdvanceSalaryFromEPF(advanceSalaryAmount); advanceSalaryAmount = 0; EPFMoney -= advanceSalaryAmount; } else { processAdvanceSalaryFromEPF(EPFMoney); EPFMoney = 0; advanceSalaryAmount -= EPFMoney; } } } bool IsNeedtoCollectMoneyFortheAdvanceSalary = false; //remaining salary deduction from the Company Provident fund contribution if (advanceSalaryAmount > 0) { if (CPFMoney > 0) { if (advanceSalaryAmount <= CPFMoney) { processAdvanceSalaryFromCPF(advanceSalaryAmount); advanceSalaryAmount = 0; CPFMoney -= advanceSalaryAmount; } else { processAdvanceSalaryFromCPF(EPFMoney); CPFMoney = 0; advanceSalaryAmount -= CPFMoney; IsNeedtoCollectMoneyFortheAdvanceSalary = true; } } } #endregion #region Fulltime Salary Process if (salaryOfthisMonth > 0) { processFullTimeSalary(salaryOfthisMonth, aCC_JournalMaster.JournalMasterID); totalJournalEntryMoney -= salaryOfthisMonth; salaryOfthisMonth = 0; } #endregion #region EPF Process if (EPFMoney > 0) { processEPF(EPFMoney, aCC_JournalMaster.JournalMasterID); totalJournalEntryMoney -= EPFMoney; EPFMoney = 0; } #endregion #region CPF Process if (CPFMoney > 0) { processCPF(CPFMoney, aCC_JournalMaster.JournalMasterID); totalJournalEntryMoney -= CPFMoney; CPFMoney = 0; } #endregion if (decimal.Parse(txtSalaryOfThisMonth.Text) > 0) { DataSet dsHeadUserFulltimeSalary = ACC_HeadUserManager.GetACC_UserByUserIDnUserTypeIDnAccountID(hfEmployeeID.Value, 2, int.Parse(ddlAccountForMoney.SelectedValue)); } //if (IsNeedtoCollectMoneyFortheAdvanceSalary) //{ // Response.Redirect(""); //} btnJournalEntry.Visible = false; } }
protected void btnJournalSubmit_Click(object sender, EventArgs e) { List<ACC_HeadType> allACC_HeadType= ACC_HeadTypeManager.GetAllACC_HeadTypes(); ACC_JournalMaster aCC_JournalMaster = new ACC_JournalMaster(); aCC_JournalMaster.JournalMasterName = "1";//Voucher Type aCC_JournalMaster.ExtraField1 = ""; aCC_JournalMaster.ExtraField2 = ""; aCC_JournalMaster.ExtraField3 = ""; aCC_JournalMaster.Note = ""; aCC_JournalMaster.JournalDate = DateTime.Parse(txtJournalDate.Text); aCC_JournalMaster.AddedBy = getLogin().LoginID; aCC_JournalMaster.AddedDate = DateTime.Now; aCC_JournalMaster.UpdatedBy = getLogin().LoginID; aCC_JournalMaster.UpdatedDate = DateTime.Now; aCC_JournalMaster.RowStatusID = 1; int JournalMasterID = 0; JournalMasterID = ACC_JournalMasterManager.InsertACC_JournalMaster(aCC_JournalMaster); foreach (GridViewRow gvr in gvACC_ChartOfAccountLabel4.Rows) { HiddenField hfChartOfAccountLabel4ID = (HiddenField)gvr.FindControl("hfChartOfAccountLabel4ID"); DropDownList ddlBank = (DropDownList)gvr.FindControl("ddlBanks"); Label lblChartOfAccountLabel4Text = (Label)gvr.FindControl("lblChartOfAccountLabel4Text"); TextBox txtCashSales = (TextBox)gvr.FindControl("txtCashSales"); TextBox txtCardSaleDBBL = (TextBox)gvr.FindControl("txtCardSaleDBBL"); TextBox txtCardSaleCITY = (TextBox)gvr.FindControl("txtCardSaleCITY"); TextBox txtbKash = (TextBox)gvr.FindControl("txtbKash"); TextBox txtBankDepostiedAmount = (TextBox)gvr.FindControl("txtBankDepostiedAmount"); TextBox txtDiscountAmount = (TextBox)gvr.FindControl("txtDiscountAmount"); if (txtCashSales.Text == "0" && txtCardSaleDBBL.Text == "0" && txtCardSaleCITY.Text == "0") { continue; } try { ACC_JournalDetail aCC_JournalDetail = new ACC_JournalDetail(); aCC_JournalDetail.JournalMasterID = JournalMasterID; aCC_JournalDetail.ExtraField3 = ""; aCC_JournalDetail.ExtraField2 = ""; aCC_JournalDetail.ExtraField1 = ""; aCC_JournalDetail.AddedBy = getLogin().LoginID; aCC_JournalDetail.AddedDate = DateTime.Now; aCC_JournalDetail.UpdatedBy = getLogin().LoginID; aCC_JournalDetail.UpdatedDate = DateTime.Now; aCC_JournalDetail.RowStatusID = 1; aCC_JournalDetail.WorkStation = int.Parse(hfChartOfAccountLabel4ID.Value); aCC_JournalDetail.WorkStationName = lblChartOfAccountLabel4Text.Text; //Discount if (txtDiscountAmount.Text != "0") { //discount Expence aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = Int32.Parse(hfChartOfAccountLabel4ID.Value); aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = lblChartOfAccountLabel4Text.Text; aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Discount"; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 181; aCC_JournalDetail.Debit = Decimal.Parse(txtDiscountAmount.Text); aCC_JournalDetail.Credit = Decimal.Parse("0"); ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); //Sales revinew discount aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = 829; aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = "All products"; aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Sales revinew discount"; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 180; aCC_JournalDetail.Credit = Decimal.Parse(txtDiscountAmount.Text); aCC_JournalDetail.Debit = Decimal.Parse("0"); ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); } ////Money entry for cash sale //aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = Int32.Parse(hfChartOfAccountLabel4ID.Value); //aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = lblChartOfAccountLabel4Text.Text; //aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Cash in Hand"; //aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 1; //aCC_JournalDetail.WorkStation = aCC_JournalDetail.ACC_ChartOfAccountLabel4ID; //aCC_JournalDetail.WorkStationName = aCC_JournalDetail.ACC_ChartOfAccountLabel4Text; //aCC_JournalDetail.Debit = Decimal.Parse(txtCashSales.Text); //aCC_JournalDetail.Credit = Decimal.Parse("0"); //if (txtCashSales.Text !="0") //ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); //Money entry for bKash Sale //<option value="1803"> Brac Bank (New Account) A/C (1524-2029-8148-6001)</option> aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = Int32.Parse(hfChartOfAccountLabel4ID.Value); aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = lblChartOfAccountLabel4Text.Text; aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = 1803; aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = "Brac Bank A/C (1524-2029-8148-6001)"; aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Cash at Bank"; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 3; aCC_JournalDetail.Debit = Decimal.Parse(txtbKash.Text); aCC_JournalDetail.Credit = Decimal.Parse("0"); if (txtbKash.Text != "0") ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); //Money entry for Crard sale CITY aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = Int32.Parse(hfChartOfAccountLabel4ID.Value); aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = lblChartOfAccountLabel4Text.Text; aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = 823; aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = "CITY BANK - GentlePark (1401307973001)"; aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Cash at Bank"; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 3; aCC_JournalDetail.Debit = Decimal.Parse(txtCardSaleCITY.Text); aCC_JournalDetail.Credit = Decimal.Parse("0"); if (txtCardSaleCITY.Text != "0") ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); //Money entry for Crard sale DBBL aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = 828; aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = "DBBL-126-110-11033"; aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Cash at Bank"; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 3; aCC_JournalDetail.Debit = Decimal.Parse(txtCardSaleDBBL.Text); aCC_JournalDetail.Credit = Decimal.Parse("0"); if (txtCardSaleDBBL.Text != "0") ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); //bKash sales //<option value="315">bKash Sales ( (Operating income)-Sales Revenue -> Sales Revenue)</option> aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = 829; aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = "All products"; aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "bKash sales"; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 315; aCC_JournalDetail.Credit = Decimal.Parse(txtbKash.Text); aCC_JournalDetail.Debit = Decimal.Parse("0"); if (txtbKash.Text != "0") ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); //Cash Sales DBBL aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = 829; aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = "All products"; aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Card Sales (DBBL)"; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 107; aCC_JournalDetail.Credit = Decimal.Parse(txtCardSaleDBBL.Text); aCC_JournalDetail.Debit = Decimal.Parse("0"); if (txtCardSaleDBBL.Text != "0") ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); //Cash Sales CITY aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = 829; aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = "All products"; aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Card Sales (CITY)"; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 143; aCC_JournalDetail.Credit = Decimal.Parse(txtCardSaleCITY.Text); aCC_JournalDetail.Debit = Decimal.Parse("0"); if (txtCardSaleCITY.Text != "0") ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); if (ddlBank.SelectedValue != "0" && txtCashSales.Text != "0") //if (ddlBank.SelectedValue != "0" && txtBankDepostiedAmount.Text != "0") { //Cash Sales aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = 829; aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = "All products"; aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Cash Sale"; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 106; aCC_JournalDetail.Credit = Decimal.Parse(txtCashSales.Text); aCC_JournalDetail.Debit = Decimal.Parse("0"); ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); ////Bank Deposit //aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = Int32.Parse(hfChartOfAccountLabel4ID.Value); //aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = lblChartOfAccountLabel4Text.Text; //aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Cash in Hand"; //aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 1; //aCC_JournalDetail.WorkStation = aCC_JournalDetail.ACC_ChartOfAccountLabel4ID; //aCC_JournalDetail.WorkStationName = aCC_JournalDetail.ACC_ChartOfAccountLabel4Text; ////aCC_JournalDetail.Credit = Decimal.Parse(txtBankDepostiedAmount.Text); //aCC_JournalDetail.Credit = Decimal.Parse(txtCashSales.Text); //aCC_JournalDetail.Debit = Decimal.Parse("0"); //ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = Int32.Parse(ddlBank.SelectedValue); aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = ddlBank.SelectedItem.Text; aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Cash at Bank"; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 3; //aCC_JournalDetail.Debit = Decimal.Parse(txtBankDepostiedAmount.Text); aCC_JournalDetail.Debit = Decimal.Parse(txtCashSales.Text); aCC_JournalDetail.Credit = Decimal.Parse("0"); ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); } } catch (Exception ex) { } } hlnkPrintVoucher.Visible = true; hlnkPrintVoucher.NavigateUrl = "Voucherprint.aspx?JournalMasterID=" + JournalMasterID; }
protected void btnAdd_Click(object sender, EventArgs e) { if (barCodeChecking()) { return; } int TransactionMasterID = 0; int JournalMasterID = 0; if (txtOldTrasactionID.Text != "") { if (hfTransactionMasterID.Value == "0") { TransactionMasterID = int.Parse(GetTransactionMasterID().Split('@')[0]); JournalMasterID = int.Parse(GetTransactionMasterID().Split('@')[1]); } else { TransactionMasterID = int.Parse(hfTransactionMasterID.Value); JournalMasterID = int.Parse(hfJournalMasterID.Value); } if (TransactionMasterID == 0) { showAlartMessage("Wrong old ID"); return; } } else { //Regenerate ta kon transaction master er under e probe? Pos_TransactionMaster pos_TransactionMaster = new Pos_TransactionMaster(); pos_TransactionMaster.TransactionDate = DateTime.Parse(txtProductionDate.Text); pos_TransactionMaster.TransactionID = 0; pos_TransactionMaster.Pos_TransactionTypeID = (Request.QueryString["IsPurchased"] == null ? 1 : 25); pos_TransactionMaster.ToOrFromID = (Request.QueryString["IsPurchased"] != null ? int.Parse(ddlSuppier.SelectedValue) : int.Parse(ddlProductionUnit.SelectedValue)); pos_TransactionMaster.Record = ""; pos_TransactionMaster.Particulars = txtNote.Text; pos_TransactionMaster.WorkSatationID = (Request.QueryString["IsPurchased"] != null ? 1 : int.Parse(ddlProductionUnit.SelectedValue)); ; pos_TransactionMaster.ExtraField1 = ""; pos_TransactionMaster.ExtraField2 = ""; pos_TransactionMaster.ExtraField3 = ""; pos_TransactionMaster.ExtraField4 = ""; pos_TransactionMaster.ExtraField5 = ""; pos_TransactionMaster.AddedBy = getLogin().LoginID; pos_TransactionMaster.AddedDate = DateTime.Now; pos_TransactionMaster.UpdatedBy = getLogin().LoginID; pos_TransactionMaster.UpdatedDate = DateTime.Now; pos_TransactionMaster.RowStatusID = 1; TransactionMasterID = Pos_TransactionMasterManager.InsertPos_TransactionMaster(pos_TransactionMaster); pos_TransactionMaster = Pos_TransactionMasterManager.GetPos_TransactionMasterByID(TransactionMasterID); txtOldTrasactionID.Text = pos_TransactionMaster.TransactionID.ToString(); hfTransactionMasterID.Value = TransactionMasterID.ToString(); if (Request.QueryString["IsPurchased"] != null) { //Journal Entry ACC_JournalMaster aCC_JournalMaster = new ACC_JournalMaster(); aCC_JournalMaster.JournalMasterName = "3";//Journal Voucher aCC_JournalMaster.ExtraField1 = ddlSuppier.SelectedItem.Text; aCC_JournalMaster.ExtraField2 = ""; aCC_JournalMaster.ExtraField3 = ""; aCC_JournalMaster.Note = "Product Purchase-" + pos_TransactionMaster.TransactionID.ToString(); aCC_JournalMaster.JournalDate = pos_TransactionMaster.TransactionDate; aCC_JournalMaster.AddedBy = getLogin().LoginID; aCC_JournalMaster.AddedDate = DateTime.Now; aCC_JournalMaster.UpdatedBy = getLogin().LoginID; aCC_JournalMaster.UpdatedDate = DateTime.Now; aCC_JournalMaster.RowStatusID = 1; JournalMasterID = ACC_JournalMasterManager.InsertACC_JournalMaster(aCC_JournalMaster); hfJournalMasterID.Value = JournalMasterID.ToString(); } } Pos_Product pos_Product = new Pos_Product(); pos_Product.ProductID = Int32.Parse(ddlProduct.SelectedValue); pos_Product.ReferenceID = TransactionMasterID; pos_Product.Pos_ProductTypeID = 1; pos_Product.ProductStatusID = Int32.Parse(ddlProductStatus.SelectedValue); pos_Product.ProductName = ddlProduct.SelectedItem.Text; pos_Product.Pos_BrandID = Int32.Parse(ddlPos_Brand.SelectedValue); pos_Product.Inv_QuantityUnitID = Int32.Parse(ddlInv_QuantityUnit.SelectedValue); pos_Product.Note = txtNote.Text; pos_Product.Pic1 = txtPicture.Value; pos_Product.Pic2 = ""; pos_Product.Pic3 = ""; pos_Product.VatPercentage = Decimal.Parse(txtVatPercentage.Text); pos_Product.IsVatExclusive = cbIsVatExclusive.Checked; pos_Product.DiscountPercentage = Decimal.Parse(txtDiscountPercentage.Text); pos_Product.FabricsNo = ddlProductionUnit.SelectedValue; pos_Product.ExtraField1 = ""; pos_Product.ExtraField2 = ""; pos_Product.ExtraField3 = ""; pos_Product.ExtraField4 = ""; pos_Product.ExtraField5 = ""; pos_Product.ExtraField6 = ""; pos_Product.ExtraField7 = ""; pos_Product.ExtraField8 = ""; pos_Product.ExtraField9 = ddlSuppier.SelectedValue; pos_Product.ExtraField10 = JournalMasterID.ToString(); pos_Product.AddedBy = getLogin().LoginID; pos_Product.AddedDate = DateTime.Now; pos_Product.UpdatedBy = getLogin().LoginID; pos_Product.UpdatedDate = DateTime.Now; pos_Product.RowStatusID = 1; string ids = ""; foreach (GridViewRow gvr in gvProductConfiguration.Rows) { /* <asp:HiddenField ID="hfColorID" runat="server" Value='<%#Eval("Pos_ColorID") %>'/> <asp:HiddenField ID="hfPos_SizeID" runat="server" Value='<%#Eval("Pos_SizeID") %>'/> <asp:HiddenField ID="hfFabricsCost" runat="server" Value='<%#Eval("FabricsCost") %>'/> <asp:HiddenField ID="hfAccesoriesCost" runat="server" Value='<%#Eval("AccesoriesCost") %>'/> <asp:HiddenField ID="hfOverhead" runat="server" Value='<%#Eval("Overhead") %>'/> <asp:HiddenField ID="hfOthersCost" runat="server" Value='<%#Eval("OthersCost") %>'/> <asp:HiddenField ID="hfUtilizationIDs" runat="server" Value='<%#Eval("Inv_UtilizationDetailsIDs") %>'/> */ HiddenField hfColorID = (HiddenField)gvr.FindControl("hfColorID"); HiddenField hfPos_SizeID = (HiddenField)gvr.FindControl("hfPos_SizeID"); HiddenField hfFabricsCost = (HiddenField)gvr.FindControl("hfFabricsCost"); HiddenField hfAccesoriesCost = (HiddenField)gvr.FindControl("hfAccesoriesCost"); HiddenField hfOverhead = (HiddenField)gvr.FindControl("hfOverhead"); HiddenField hfOthersCost = (HiddenField)gvr.FindControl("hfOthersCost"); HiddenField hfUtilizationIDs = (HiddenField)gvr.FindControl("hfUtilizationIDs"); HiddenField hfProductCode = (HiddenField)gvr.FindControl("hfProductCode"); HiddenField hfDesignCode = (HiddenField)gvr.FindControl("hfDesignCode"); HiddenField hfSizeCode = (HiddenField)gvr.FindControl("hfSizeCode"); DropDownList ddlColor_Config = (DropDownList)gvr.FindControl("ddlColor_Config"); DropDownList ddlPos_FabricsType = (DropDownList)gvr.FindControl("ddlPos_FabricsType"); TextBox txtSalesPrice_Config = (TextBox)gvr.FindControl("txtSalesPrice_Config"); TextBox txtCurrentProcessing = (TextBox)gvr.FindControl("txtCurrentProcessing"); TextBox lblAgvCosting = (TextBox)gvr.FindControl("lblAgvCosting"); TextBox lblBarCode = (TextBox)gvr.FindControl("lblBarCode"); pos_Product.Inv_UtilizationDetailsIDs = hfUtilizationIDs.Value; pos_Product.Pos_SizeID = Int32.Parse(hfPos_SizeID.Value); pos_Product.FabricsCost = Decimal.Parse(hfFabricsCost.Value); pos_Product.AccesoriesCost = Decimal.Parse(hfAccesoriesCost.Value); pos_Product.Overhead = Decimal.Parse(hfOverhead.Value); pos_Product.OthersCost = Decimal.Parse(hfOthersCost.Value); pos_Product.PurchasePrice = (Request.QueryString["IsPurchased"] == null?0:Decimal.Parse(lblAgvCosting.Text)); pos_Product.SalePrice = Decimal.Parse(txtSalesPrice_Config.Text); pos_Product.OldSalePrice =0; pos_Product.DiscountAmount =((pos_Product.SalePrice * Decimal.Parse(txtDiscountPercentage.Text))/100); pos_Product.Pos_ColorID = Int32.Parse(ddlColor_Config.SelectedValue); pos_Product.Pos_FabricsTypeID = Int32.Parse(ddlPos_FabricsType.SelectedValue); pos_Product.ExtraField1 = txtCurrentProcessing.Text; pos_Product.DesignCode = hfDesignCode.Value; pos_Product.BarCode = lblBarCode.Text; pos_Product.StyleCode = txtStyle.Text;//getStyleCode(pos_Product); int productID = Pos_ProductManager.InsertPos_Product(pos_Product); ids += (ids != "" ? "," : "") + productID.ToString(); } SaveForRemoteDB(ids); processUtilizationDetails(TransactionMasterID); hlnkProductionPrint.Visible = true; hlnkProductionPrint.NavigateUrl = "TransactionPrint.aspx?Pos_TransactionMasterID="+TransactionMasterID.ToString(); btnClear_Click(this, new EventArgs()); }
protected void btnJournalSubmit_Click(object sender, EventArgs e) { List<ACC_HeadType> allACC_HeadType= ACC_HeadTypeManager.GetAllACC_HeadTypes(); foreach (GridViewRow gvr in gvACC_ChartOfAccountLabel3.Rows) { HiddenField hfChartOfAccountLabel3ID = (HiddenField)gvr.FindControl("hfChartOfAccountLabel3ID"); DropDownList ddlACC_ChartOfAccountLabel4 = (DropDownList)gvr.FindControl("ddlACC_ChartOfAccountLabel4"); Label lblChartOfAccountLabel3Text = (Label)gvr.FindControl("lblChartOfAccountLabel3Text"); Label lblJournalMasterID = (Label)gvr.FindControl("lblJournalMasterID"); TextBox txtJournalDate = (TextBox)gvr.FindControl("txtJournalDate"); TextBox txtAmount = (TextBox)gvr.FindControl("txtAmount"); TextBox txtPayto = (TextBox)gvr.FindControl("txtPayto"); TextBox txtAddress = (TextBox)gvr.FindControl("txtAddress"); TextBox txtNote = (TextBox)gvr.FindControl("txtNote"); TextBox txtCheckDate = (TextBox)gvr.FindControl("txtCheckDate"); TextBox txtCheckNo = (TextBox)gvr.FindControl("txtCheckNo"); TextBox txtBank = (TextBox)gvr.FindControl("txtBank"); if (txtAmount.Text == "0") { continue; } try { ACC_JournalMaster aCC_JournalMaster = new ACC_JournalMaster(); aCC_JournalMaster.JournalMasterName = "2";//Voucher Type aCC_JournalMaster.ExtraField1 = txtPayto.Text; aCC_JournalMaster.ExtraField2 = txtAddress.Text; aCC_JournalMaster.ExtraField3 = ""; aCC_JournalMaster.Note = txtNote.Text; aCC_JournalMaster.JournalDate = DateTime.Parse(txtJournalDate.Text); aCC_JournalMaster.AddedBy = getLogin().LoginID; aCC_JournalMaster.AddedDate = DateTime.Now; aCC_JournalMaster.UpdatedBy = getLogin().LoginID; aCC_JournalMaster.UpdatedDate = DateTime.Now; aCC_JournalMaster.RowStatusID = 1; int JournalMasterID = 0; JournalMasterID = ACC_JournalMasterManager.InsertACC_JournalMaster(aCC_JournalMaster); ACC_JournalDetail aCC_JournalDetail = new ACC_JournalDetail(); aCC_JournalDetail.JournalMasterID = JournalMasterID; if(ddlACC_ChartOfAccountLabel4.SelectedValue != "0") { aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = Int32.Parse(ddlACC_ChartOfAccountLabel4.SelectedValue); aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = ddlACC_ChartOfAccountLabel4.SelectedItem.Text; } else { aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = 0; aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = "N/A"; } aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = lblChartOfAccountLabel3Text.Text; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = Int32.Parse(hfChartOfAccountLabel3ID.Value); string workStationText = ""; foreach (ACC_HeadType item in allACC_HeadType) { if (item.ACC_HeadTypeID == 1) { workStationText = item.HeadTypeName; break; } } if (ddlACC_ChartOfAccountLabel4.SelectedItem.Text.Contains(workStationText)) { aCC_JournalDetail.WorkStation = aCC_JournalDetail.ACC_ChartOfAccountLabel4ID; aCC_JournalDetail.WorkStationName = aCC_JournalDetail.ACC_ChartOfAccountLabel4Text; } else { aCC_JournalDetail.WorkStation = 1; aCC_JournalDetail.WorkStationName = "Head Office"; } aCC_JournalDetail.Debit = Decimal.Parse(txtAmount.Text); aCC_JournalDetail.Credit = Decimal.Parse("0"); aCC_JournalDetail.ExtraField3 = ""; aCC_JournalDetail.ExtraField2 = ""; aCC_JournalDetail.ExtraField1 = ""; aCC_JournalDetail.AddedBy = getLogin().LoginID; aCC_JournalDetail.AddedDate = DateTime.Now; aCC_JournalDetail.UpdatedBy = getLogin().LoginID; aCC_JournalDetail.UpdatedDate = DateTime.Now; aCC_JournalDetail.RowStatusID = 1; //For Debit part ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); //For Money Entry aCC_JournalDetail.ACC_ChartOfAccountLabel3Text =""; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = int.Parse(ddlBalance.SelectedValue.Split('@')[0]); aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = int.Parse(ddlBalance.SelectedValue.Split('@')[1]); aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = ""; aCC_JournalDetail.Debit = 0; aCC_JournalDetail.Credit = Decimal.Parse(txtAmount.Text); aCC_JournalDetail.WorkStation = 1; aCC_JournalDetail.WorkStationName = "Head Office"; aCC_JournalDetail.ExtraField3 = txtCheckNo.Text; aCC_JournalDetail.ExtraField2 = txtBank.Text; aCC_JournalDetail.ExtraField1 = txtCheckDate.Text; ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); lblJournalMasterID.Text = "<a href='Voucherprint.aspx?JournalMasterID=" + JournalMasterID.ToString() + "' target='_blank'>PV # " + JournalMasterID.ToString() + "</a>"; //showAlartMessage("Successfully Done."); } catch (Exception ex) { lblJournalMasterID.Text = "<span style='color:red;'>Error !!</span>"; //showAlartMessage("Error occured"); } } }
public static bool UpdateACC_JournalMaster(ACC_JournalMaster aCC_JournalMaster) { SqlACC_JournalMasterProvider sqlACC_JournalMasterProvider = new SqlACC_JournalMasterProvider(); return sqlACC_JournalMasterProvider.UpdateACC_JournalMaster(aCC_JournalMaster); }
protected void btnJournalSubmit_Click(object sender, EventArgs e) { List<ACC_HeadType> allACC_HeadType= ACC_HeadTypeManager.GetAllACC_HeadTypes(); ACC_JournalMaster aCC_JournalMaster = new ACC_JournalMaster(); aCC_JournalMaster.JournalMasterName = "2";//Contra aCC_JournalMaster.ExtraField1 = ""; aCC_JournalMaster.ExtraField2 = ""; aCC_JournalMaster.ExtraField3 = ""; aCC_JournalMaster.Note = ""; aCC_JournalMaster.JournalDate = DateTime.Parse(txtJournalDate.Text); aCC_JournalMaster.AddedBy = getLogin().LoginID; aCC_JournalMaster.AddedDate = DateTime.Now; aCC_JournalMaster.UpdatedBy = getLogin().LoginID; aCC_JournalMaster.UpdatedDate = DateTime.Now; aCC_JournalMaster.RowStatusID = 1; int JournalMasterID = 0; JournalMasterID = ACC_JournalMasterManager.InsertACC_JournalMaster(aCC_JournalMaster); foreach (GridViewRow gvr in gvACC_ChartOfAccountLabel4.Rows) { HiddenField hfChartOfAccountLabel4ID = (HiddenField)gvr.FindControl("hfChartOfAccountLabel4ID"); DropDownList ddlSupplier = (DropDownList)gvr.FindControl("ddlSupplier"); Label lblChartOfAccountLabel4Text = (Label)gvr.FindControl("lblChartOfAccountLabel4Text"); TextBox txtOpiningBalance = (TextBox)gvr.FindControl("txtOpiningBalance"); TextBox txtSypplyerPayment = (TextBox)gvr.FindControl("txtSypplyerPayment"); TextBox txtDiscountIncome = (TextBox)gvr.FindControl("txtDiscountIncome"); try { ACC_JournalDetail aCC_JournalDetail = new ACC_JournalDetail(); aCC_JournalDetail.JournalMasterID = JournalMasterID; aCC_JournalDetail.ExtraField3 = ""; aCC_JournalDetail.ExtraField2 = ""; aCC_JournalDetail.ExtraField1 = ""; aCC_JournalDetail.AddedBy = getLogin().LoginID; aCC_JournalDetail.AddedDate = DateTime.Now; aCC_JournalDetail.UpdatedBy = getLogin().LoginID; aCC_JournalDetail.UpdatedDate = DateTime.Now; aCC_JournalDetail.RowStatusID = 1; aCC_JournalDetail.WorkStation = 1; aCC_JournalDetail.WorkStationName = "Heand Office"; //Supplier Payment for Cash in hand aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = Int32.Parse(hfChartOfAccountLabel4ID.Value); aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = lblChartOfAccountLabel4Text.Text; aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Cahs in Hand"; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 1; aCC_JournalDetail.Credit = Decimal.Parse(txtSypplyerPayment.Text); aCC_JournalDetail.Debit = Decimal.Parse("0"); if (txtSypplyerPayment.Text != "0" && ddlSupplier.SelectedValue!="0") ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); //Supplier Payment for Suppliyer if (txtSypplyerPayment.Text != "0" && ddlSupplier.SelectedValue != "0") aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = Int32.Parse(ddlSupplier.SelectedValue); aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = ddlSupplier.SelectedItem.Text; aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Suppliyer payable"; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 43; aCC_JournalDetail.Debit = Decimal.Parse(txtSypplyerPayment.Text); aCC_JournalDetail.Credit = Decimal.Parse("0"); if (txtSypplyerPayment.Text != "0" && ddlSupplier.SelectedValue != "0") ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); //Cash discount supplier payable aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = Int32.Parse(ddlSupplier.SelectedValue); aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = ddlSupplier.SelectedItem.Text; aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Suppliyer payable"; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 43; aCC_JournalDetail.Debit = Decimal.Parse(txtDiscountIncome.Text); aCC_JournalDetail.Credit = Decimal.Parse("0"); if (txtDiscountIncome.Text != "0" && txtDiscountIncome.Text != "" && ddlSupplier.SelectedValue != "0") ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); //Cash discount for Income aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = Int32.Parse(ddlSupplier.SelectedValue); aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = ddlSupplier.SelectedItem.Text; aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = "Cash Discount from Supplier"; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = 211; aCC_JournalDetail.Credit = Decimal.Parse(txtDiscountIncome.Text); aCC_JournalDetail.Debit = Decimal.Parse("0"); if (txtDiscountIncome.Text != "0" && txtDiscountIncome.Text != "" && ddlSupplier.SelectedValue != "0") ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); } catch (Exception ex) { } } hlnkPrintVoucher.Visible = true; hlnkPrintVoucher.NavigateUrl = "Voucherprint.aspx?JournalMasterID=" + JournalMasterID; }
public static int InsertACC_JournalMasterTmp(ACC_JournalMaster aCC_JournalMaster) { SqlACC_JournalMasterProvider sqlACC_JournalMasterProvider = new SqlACC_JournalMasterProvider(); return(sqlACC_JournalMasterProvider.InsertACC_JournalMasterTmp(aCC_JournalMaster)); }
protected void btnJournalEntry_Click(object sender, EventArgs e) { ACC_JournalMaster aCC_JournalMaster = new ACC_JournalMaster(); aCC_JournalMaster.JournalMasterName = ""; aCC_JournalMaster.AddedBy = Profile.card_id; aCC_JournalMaster.AddedDate = DateTime.Now; aCC_JournalMaster.UpdatedBy = Profile.card_id; aCC_JournalMaster.UpdateDate = DateTime.Now; aCC_JournalMaster.RowStatusID = 1; aCC_JournalMaster.JournalMasterID = ACC_JournalMasterManager.InsertACC_JournalMaster(aCC_JournalMaster); foreach (ACC_Journal eachJournal in doubleEntry) { eachJournal.JournalMasterID = aCC_JournalMaster.JournalMasterID; ACC_JournalManager.InsertACC_Journal(eachJournal); } lblMessage.Text = "Journal Entry Successful"; if (Request.QueryString["AccountID"] != null) { if (int.Parse(Request.QueryString["AccountID"]) >= 29 && int.Parse(Request.QueryString["AccountID"]) <= 37) { lblMessage.Text += " <a href='../Accounting/MoneyReceipt.aspx?StudentID=" + hfStudentID.Value + "&Amount=" + lblDebit.Text + "' target='_blank'>Click here to Print the receipt</a>"; } else if (int.Parse(Request.QueryString["AccountID"]) >= 17 && int.Parse(Request.QueryString["AccountID"]) <= 19) { lblMessage.Text += " <a href='../Accounting/ViewTeacherMoneyReceit.aspx?EmployeeID=" + ddlAccountingUser.SelectedValue + "&Amount=" + lblDebit.Text + "' target='_blank'>Click here to Print the receipt</a>"; } } lblMessage.ForeColor = System.Drawing.Color.Green; }
public static bool UpdateACC_JournalMaster(ACC_JournalMaster aCC_JournalMaster) { SqlACC_JournalMasterProvider sqlACC_JournalMasterProvider = new SqlACC_JournalMasterProvider(); return(sqlACC_JournalMasterProvider.UpdateACC_JournalMaster(aCC_JournalMaster)); }
private void loadData() { try { ACC_JournalMaster journalMaster = ACC_JournalMasterManager.GetACC_JournalMasterByID(int.Parse(Request.QueryString["JournalMasterID"])); List <ACC_JournalDetail> journalDetails = ACC_JournalDetailManager.GetAllACC_JournalDetailByJournalMasterID(int.Parse(Request.QueryString["JournalMasterID"])); string journalDetailsHTML = @"<table id='tblJournalDetails' class='tdBorder' border='0' cellspacing='0' cellpadding='0' style='margin:20px 0;'> <tr style='font-weight:bold;font-size:15px;'> <td width='100px'> Account Code </td> <td width='487px'> Account Title </td> <td width='80px'> Debit </td> <td width='80px'> Credit </td> </tr>"; decimal totalDebit = 0; decimal totalCredit = 0; trAddress.Visible = false; trCheck.Visible = false; bool defaultJournal = false; switch (journalMaster.JournalMasterName) { case "1": //Receipt Voucher lblVoucherName.Text = "RECEIPT"; lblVoucherType.Text = "RV"; lblReceivedfromOrPayto.Text = "Received from"; trAddress.Visible = true; trCheck.Visible = true; //generate table foreach (ACC_JournalDetail journalDetail in journalDetails) { try { if (journalDetail.Credit == 0) { journalDetailsHTML += @"<tr> <td> " + journalDetail.ACC_ChartOfAccountLabel3Code + @" </td> <td> " + journalDetail.ACC_ChartOfAccountLabel3Text + " - " + journalDetail.ACC_ChartOfAccountLabel4Text + " (" + journalDetail.WorkStationName + @") </td> <td style='text-align:right;'> " + journalDetail.Debit.ToString("0,0.00") + @" </td> <td style='text-align:right;'> " + journalDetail.Credit.ToString("0,0.00") + @" </td> </tr>"; totalCredit += journalDetail.Credit; totalDebit += journalDetail.Debit; } } catch (Exception ex) { } } foreach (ACC_JournalDetail journalDetail in journalDetails) { try { if (journalDetail.Credit != 0) { journalDetailsHTML += @"<tr> <td> " + journalDetail.ACC_ChartOfAccountLabel3Code + @" </td> <td> " + journalDetail.ACC_ChartOfAccountLabel3Text + " - " + journalDetail.ACC_ChartOfAccountLabel4Text + " (" + journalDetail.WorkStationName + @") </td> <td style='text-align:right;'> " + journalDetail.Debit.ToString("0,0.00") + @" </td> <td style='text-align:right;'> " + journalDetail.Credit.ToString("0,0.00") + @" </td> </tr>"; totalCredit += journalDetail.Credit; totalDebit += journalDetail.Debit; } } catch (Exception ex) { } } foreach (ACC_JournalDetail journalDetail in journalDetails) { if (journalDetail.Credit == 0) { lblChequeDate.Text = journalDetail.ExtraField1; lblChequeNo.Text = journalDetail.ExtraField3; try { lblChequeBank.Text = journalDetail.ExtraField2.Split(',')[1]; } catch (Exception ex) { } try { lblChequeBranch.Text = journalDetail.ExtraField2.Split(',')[0]; } catch (Exception ex) { } break; } } lblJournalDetials.Text = journalDetailsHTML + "<tr><td></td><td><b>Total:</b></td><td style='text-align:right;'>" + totalDebit.ToString("0,0.00") + "</td><td style='text-align:right;'>" + totalCredit.ToString("0,0.00") + "</td></tr><tr><td colspan='4'><b>Taka in words:</b> " + NumberToWords(int.Parse(totalCredit.ToString("0"))) + " taka only.</td></tr></table>"; break; case "2": //Payment Voucher lblVoucherName.Text = "PAYMENT"; lblVoucherType.Text = "PV"; lblReceivedfromOrPayto.Text = "Pay To"; trAddress.Visible = true; trCheck.Visible = true; //generate table foreach (ACC_JournalDetail journalDetail in journalDetails) { try { if (journalDetail.Credit == 0) { journalDetailsHTML += @"<tr> <td> " + journalDetail.ACC_ChartOfAccountLabel3Code + @" </td> <td> " + journalDetail.ACC_ChartOfAccountLabel3Text + " - " + journalDetail.ACC_ChartOfAccountLabel4Text + " (" + journalDetail.WorkStationName + @") </td> <td style='text-align:right;'> " + journalDetail.Debit.ToString("0,0.00") + @" </td> <td style='text-align:right;'> " + journalDetail.Credit.ToString("0,0.00") + @" </td> </tr>"; totalCredit += journalDetail.Credit; totalDebit += journalDetail.Debit; } } catch (Exception ex) { } } foreach (ACC_JournalDetail journalDetail in journalDetails) { try { if (journalDetail.Credit != 0) { journalDetailsHTML += @"<tr> <td> " + journalDetail.ACC_ChartOfAccountLabel3Code + @" </td> <td> " + journalDetail.ACC_ChartOfAccountLabel3Text + " - " + journalDetail.ACC_ChartOfAccountLabel4Text + " (" + journalDetail.WorkStationName + @") </td> <td style='text-align:right;'> " + journalDetail.Debit.ToString("0,0.00") + @" </td> <td style='text-align:right;'> " + journalDetail.Credit.ToString("0,0.00") + @" </td> </tr>"; totalCredit += journalDetail.Credit; totalDebit += journalDetail.Debit; } } catch (Exception ex) { } } foreach (ACC_JournalDetail journalDetail in journalDetails) { if (journalDetail.Debit == 0) { lblChequeDate.Text = journalDetail.ExtraField1; lblChequeNo.Text = journalDetail.ExtraField3; try { lblChequeBank.Text = journalDetail.ExtraField2.Split(',')[1]; } catch (Exception ex) { } try { lblChequeBranch.Text = journalDetail.ExtraField2.Split(',')[0]; } catch (Exception ex) { } break; } } lblJournalDetials.Text = journalDetailsHTML + "<tr><td></td><td><b>Total:</b></td><td style='text-align:right;'>" + totalDebit.ToString("0,0.00") + "</td><td style='text-align:right;'>" + totalCredit.ToString("0,0.00") + "</td></tr><tr><td colspan='4'><b>Taka in words:</b> " + NumberToWords(int.Parse(totalDebit.ToString("0"))) + " taka only.</td></tr></table>"; break; case "3": //Journal Voucher lblVoucherName.Text = "JOURNAL"; lblVoucherType.Text = "JV"; defaultJournal = true; break; case "4": //Contra Voucher lblVoucherName.Text = "CONTRA"; lblVoucherType.Text = "CV"; trCheck.Visible = true; defaultJournal = true; foreach (ACC_JournalDetail journalDetail in journalDetails) { if (journalDetail.ExtraField3 != "") { lblChequeDate.Text = journalDetail.ExtraField1; lblChequeNo.Text = journalDetail.ExtraField3; try { lblChequeBank.Text = journalDetail.ExtraField2.Split(',')[1]; } catch (Exception ex) { } try { lblChequeBranch.Text = journalDetail.ExtraField2.Split(',')[0]; } catch (Exception ex) { } break; } } break; default: break; } if (defaultJournal) { foreach (ACC_JournalDetail journalDetail in journalDetails) { try { journalDetailsHTML += @"<tr> <td> " + journalDetail.ACC_ChartOfAccountLabel3Code + @" </td> <td> " + journalDetail.ACC_ChartOfAccountLabel3Text + " - " + journalDetail.ACC_ChartOfAccountLabel4Text + " (" + journalDetail.WorkStationName + @") </td> <td style='text-align:right;'> " + journalDetail.Debit.ToString("0,0.00") + @" </td> <td style='text-align:right;'> " + journalDetail.Credit.ToString("0,0.00") + @" </td> </tr>"; totalCredit += journalDetail.Credit; totalDebit += journalDetail.Debit; } catch (Exception ex) { } } lblJournalDetials.Text = journalDetailsHTML + "<tr><td></td><td><b>Total:</b></td><td style='text-align:right;'>" + totalDebit.ToString("0,0.00") + "</td><td style='text-align:right;'>" + totalCredit.ToString("0,0.00") + "</td></tr><tr><td colspan='4'><b>Taka in words:</b> " + NumberToWords(int.Parse(totalCredit.ToString("0"))) + " taka only.</td></tr></table>"; } lblOfficeName.Text = journalDetails[0].WorkStationName; lblJournalMasterID.Text = Request.QueryString["JournalMasterID"]; if (journalMaster.RowStatusID != 1) { lblJournalMasterID.BackColor = System.Drawing.Color.Red; } lblDate.Text = journalMaster.JournalDate.ToString("dd MMM yyyy"); lblCustomerName.Text = journalMaster.ExtraField1; lblAddress.Text = journalMaster.ExtraField2; if (journalMaster.Note.Contains("Inventory Purchase-")) { lblExplanation.Text = "<a href='../Inventory/PurchasePrint.aspx?PurchaseID=" + journalMaster.Note.Replace("Inventory Purchase-", "") + "' target='_blank'>" + journalMaster.Note + "</a>"; } else { lblExplanation.Text = journalMaster.Note; } gvJournal.DataSource = journalDetails; gvJournal.DataBind(); List <ACC_ChartOfAccountLabel4> aCC_ChartOfAccountLabel4s = new List <ACC_ChartOfAccountLabel4>(); aCC_ChartOfAccountLabel4s = ACC_ChartOfAccountLabel4Manager.GetAllACC_ChartOfAccountLabel4sForJournalEntry(); DataSet ds = CommonManager.SQLExec( @" SELECT ACC_ChartOfAccountLabel3.ChartOfAccountLabel3Text +'('+ ACC_ChartOfAccountLabel2.ChartOfAccountLabel2Text +')('+ ACC_ChartOfAccountLabel1.ChartOfAccountLabel1Text+')' as Head, ACC_ChartOfAccountLabel3.ACC_ChartOfAccountLabel3ID FROM ACC_ChartOfAccountLabel1 INNER JOIN ACC_ChartOfAccountLabel2 ON ACC_ChartOfAccountLabel1.ACC_ChartOfAccountLabel1ID = ACC_ChartOfAccountLabel2.ACC_ChartOfAccountLabel1ID INNER JOIN ACC_ChartOfAccountLabel3 ON ACC_ChartOfAccountLabel2.ACC_ChartOfAccountLabel2ID = ACC_ChartOfAccountLabel3.ACC_ChartOfAccountLabel2ID where ACC_ChartOfAccountLabel3.RowStatusID=1 order by ACC_ChartOfAccountLabel1.ChartOfAccountLabel1Text,ACC_ChartOfAccountLabel2.ChartOfAccountLabel2Text,ACC_ChartOfAccountLabel3.ChartOfAccountLabel3Text " ); ddlL4.Items.Clear(); ddlL3.Items.Clear(); ddlWorkStation.Items.Clear(); ddlL4.Items.Add(new ListItem("N/A", "0")); ddlL3.Items.Add(new ListItem("N/A", "0")); ddlWorkStation.Items.Add(new ListItem("N/A", "0")); foreach (ACC_ChartOfAccountLabel4 aCC_ChartOfAccountLabel4 in aCC_ChartOfAccountLabel4s) { ddlL4.Items.Add(new ListItem( ( aCC_ChartOfAccountLabel4.ACC_HeadTypeID == 9 ? "Access(Prod)" : ( aCC_ChartOfAccountLabel4.ACC_HeadTypeID == 10 ? "Access (Non-Prod)" : ( aCC_ChartOfAccountLabel4.ACC_HeadTypeID == 2 ? "Fabrics" : ( aCC_ChartOfAccountLabel4.ACC_HeadTypeID == 3 ? "Product" : aCC_ChartOfAccountLabel4.ACC_HeadTypeID.ToString() ) ) ) ) + "-" + aCC_ChartOfAccountLabel4.ChartOfAccountLabel4Text.ToString(), aCC_ChartOfAccountLabel4.ACC_ChartOfAccountLabel4ID.ToString())); if (aCC_ChartOfAccountLabel4.ACC_HeadTypeID == 1) { ListItem item = new ListItem(aCC_ChartOfAccountLabel4.ChartOfAccountLabel4Text.ToString(), aCC_ChartOfAccountLabel4.ACC_ChartOfAccountLabel4ID.ToString()); ddlWorkStation.Items.Add(item); } } foreach (DataRow dr in ds.Tables[0].Rows) { ddlL3.Items.Add(new ListItem(dr["Head"].ToString(), dr["ACC_ChartOfAccountLabel3ID"].ToString())); } /* * //List<ACC_ChartOfAccountLabel3> aCC_ChartOfAccountLabel3s = new List<ACC_ChartOfAccountLabel3>(); * //aCC_ChartOfAccountLabel3s = ACC_ChartOfAccountLabel3Manager.GetAllACC_ChartOfAccountLabel3sForJournalEntryForDropDownList(); * * foreach (GridViewRow gvr in gvJournal.Rows) * { * HiddenField hfWorkStationID = (HiddenField)gvr.FindControl("hfWorkStationID"); * HiddenField hfACC_ChartOfAccountLabel4ID = (HiddenField)gvr.FindControl("hfACC_ChartOfAccountLabel4ID"); * HiddenField hfACC_ChartOfAccountLabel3ID = (HiddenField)gvr.FindControl("hfACC_ChartOfAccountLabel3ID"); * DropDownList ddlWorkStation = (DropDownList)gvr.FindControl("ddlWorkStation"); * DropDownList ddlL3 = (DropDownList)gvr.FindControl("ddlL3"); * DropDownList ddlL4 = (DropDownList)gvr.FindControl("ddlL4"); * foreach (ACC_ChartOfAccountLabel4 aCC_ChartOfAccountLabel4 in aCC_ChartOfAccountLabel4s) * { * ddlL4.Items.Add(new ListItem( * ( * aCC_ChartOfAccountLabel4.ACC_HeadTypeID == 9 * ? "Access(Prod)" : * ( * aCC_ChartOfAccountLabel4.ACC_HeadTypeID == 10 * ? "Access (Non-Prod)" : * ( * aCC_ChartOfAccountLabel4.ACC_HeadTypeID == 2 * ? "Fabrics" : aCC_ChartOfAccountLabel4.ACC_HeadTypeID.ToString() * ) * ) * ) + "-" + aCC_ChartOfAccountLabel4.ChartOfAccountLabel4Text.ToString(), aCC_ChartOfAccountLabel4.ACC_ChartOfAccountLabel4ID.ToString())); + if (aCC_ChartOfAccountLabel4.ACC_HeadTypeID == 1) + { + ListItem item = new ListItem(aCC_ChartOfAccountLabel4.ChartOfAccountLabel4Text.ToString(), aCC_ChartOfAccountLabel4.ACC_ChartOfAccountLabel4ID.ToString()); + ddlWorkStation.Items.Add(item); + } + } + foreach (DataRow dr in ds.Tables[0].Rows) + { + ddlL3.Items.Add(new ListItem(dr["Head"].ToString(), dr["ACC_ChartOfAccountLabel3ID"].ToString())); + } + + ddlL4.SelectedValue = hfACC_ChartOfAccountLabel4ID.Value; + ddlL3.SelectedValue = hfACC_ChartOfAccountLabel3ID.Value; + ddlWorkStation.SelectedValue = hfWorkStationID.Value; + } */ } catch (Exception ex) { } }
protected void btnWastage_Click(object sender, EventArgs e) { String sql = ""; int utilizationID = 0; int JournalMasterID = 0; int wastageID = 0; if (txtUtilizationID.Text == "0") { ACC_JournalMaster aCC_JournalMaster = new ACC_JournalMaster(); aCC_JournalMaster.JournalMasterName = "3";//Voucher Type aCC_JournalMaster.ExtraField1 = ""; aCC_JournalMaster.ExtraField2 = ""; aCC_JournalMaster.ExtraField3 = ""; aCC_JournalMaster.Note = txtParticulars.Text; aCC_JournalMaster.JournalDate = DateTime.Parse(txtDate.Text); aCC_JournalMaster.AddedBy = getLogin().LoginID; aCC_JournalMaster.AddedDate = DateTime.Now; aCC_JournalMaster.UpdatedBy = getLogin().LoginID; aCC_JournalMaster.UpdatedDate = DateTime.Now; aCC_JournalMaster.RowStatusID = 1; JournalMasterID = 0;//ACC_JournalMasterManager.InsertACC_JournalMaster(aCC_JournalMaster); Inv_Wastage inv_Wastage = new Inv_Wastage(); inv_Wastage.WastageDate = DateTime.Parse(txtDate.Text); inv_Wastage.IssueIDs = ""; inv_Wastage.WorkSatationID = Int32.Parse(ddlWorkSatation.SelectedValue); inv_Wastage.ExtraField1 = JournalMasterID.ToString(); inv_Wastage.ExtraField2 = ""; inv_Wastage.ExtraField3 = ""; inv_Wastage.ExtraField4 = ""; inv_Wastage.ExtraField5 = ""; inv_Wastage.AddedBy = getLogin().LoginID; inv_Wastage.AddedDate = DateTime.Now; inv_Wastage.UpdatedBy = getLogin().LoginID; inv_Wastage.UpdatedDate = DateTime.Now; inv_Wastage.RowStatusID = 1; bool isWasted = false; foreach (GridViewRow gvr in gvInv_IssueDetail.Rows) { CheckBox chkSelect = (CheckBox)gvr.FindControl("chkSelect"); TextBox txtWasted = (TextBox)gvr.FindControl("txtWasted"); if (chkSelect.Checked && txtWasted.Text != "0") { isWasted = true; } } if (isWasted) { wastageID = Inv_WastageManager.InsertInv_Wastage(inv_Wastage); hlnkWastagePrint.NavigateUrl = "WastagePrint.aspx?WastageID=" + wastageID; hlnkWastagePrint.Visible = true; } sql += "Update ACC_JournalMaster set Note='Wastage ID = " + wastageID.ToString() + "' where ACC_JournalMasterID=" + JournalMasterID.ToString() + ";"; } else { wastageID = int.Parse(txtUtilizationID.Text); DataSet ds = CommonManager.SQLExec("select ExtraField1 from Inv_Wastage where Inv_WastageID=" + txtUtilizationID.Text); if (ds.Tables[0].Rows.Count == 0) { showAlartMessage("Wrong old Wastage ID"); return; } JournalMasterID = int.Parse(ds.Tables[0].Rows[0]["ExtraField1"].ToString()); } string inv_itemID = ""; //update item foreach (GridViewRow gvr in gvInv_IssueDetail.Rows) { TextBox txtUtilization = (TextBox)gvr.FindControl("txtUtilization"); TextBox txtWasted = (TextBox)gvr.FindControl("txtWasted"); TextBox txtProductionQuantity = (TextBox)gvr.FindControl("txtProductionQuantity"); TextBox txtProductionQuantityFresh = (TextBox)gvr.FindControl("txtProductionQuantityFresh"); TextBox txtProductionQuantityReject = (TextBox)gvr.FindControl("txtProductionQuantityReject"); Label lblApproximateQuantity = (Label)gvr.FindControl("lblApproximateQuantity"); Label lblExtraField1 = (Label)gvr.FindControl("lblExtraField1"); Label lblItemCode = (Label)gvr.FindControl("lblItemCode"); Label lblPricePerUnit = (Label)gvr.FindControl("lblPricePerUnit"); Label lblProductName = (Label)gvr.FindControl("lblProductName"); CheckBox chkSelect = (CheckBox)gvr.FindControl("chkSelect"); CheckBox chkMain = (CheckBox)gvr.FindControl("chkMain"); HiddenField hfItemID = (HiddenField)gvr.FindControl("hfItemID"); HiddenField hfRawMaterialID = (HiddenField)gvr.FindControl("hfRawMaterialID"); HiddenField hfInv_IssueDetailID = (HiddenField)gvr.FindControl("hfInv_IssueDetailID"); HiddenField hfACC_HeadTypeID = (HiddenField)gvr.FindControl("hfACC_HeadTypeID"); decimal totalmoney = decimal.Parse(txtWasted.Text); if (chkSelect.Checked && decimal.Parse(txtWasted.Text) != 0) { if ( decimal.Parse(lblExtraField1.Text) < (decimal.Parse(txtWasted.Text)) ) { showAlartMessage("Stock can not be less than utilization and wastage for " + lblItemCode.Text); return; } if (chkMain.Checked) { inv_itemID = hfItemID.Value; } //update Inv_IssueDetail //update Inv_IssueDetail sql += "Update Inv_IssueDetail set ExtraField1 =(cast ((cast(ExtraField1 as decimal(18,2))-" + txtWasted.Text + ") as nvarchar)) " + (txtWasted.Text == "0" ? "" : ", ExtraField4 =(cast ((cast(ExtraField4 as decimal(18,2))+" + txtWasted.Text + ") as nvarchar)) ") + " where Inv_IssueDetailID=" + hfInv_IssueDetailID.Value + ";"; //update Inv_Item sql += "Update Inv_Item set " + (txtWasted.Text == "0" ? "" : "ExtraFieldQuantity4 +=" + txtWasted.Text + " ") + " where Inv_ItemID=" + hfItemID.Value + ";"; if (txtWasted.Text != "0") { sql += @"INSERT INTO [Inv_ItemTransaction] ([ItemID] ,[Quantity] ,[ItemTrasactionTypeID] ,[ReferenceID] ,[ExtraField1] ,[ExtraField2] ,[ExtraField3] ,[ExtraField4] ,[ExtraField5] ,[AddedBy] ,[AddedDate] ,[UpdatedBy] ,[UpdatedDate] ,[RowStatusID]) VALUES (" + hfItemID.Value + "," + txtWasted.Text + ",6," + wastageID + ",'','','','',''," + getLogin().LoginID + ",GETDATE()," + getLogin().LoginID + ",'" + DateTime.Parse(txtDate.Text).ToString("yyyy-MM-dd") + "',1);"; /* sql += @"INSERT INTO [ACC_JournalDetail] ([JournalMasterID] ,[ACC_ChartOfAccountLabel4ID] ,[ACC_ChartOfAccountLabel3ID] ,[WorkStation] ,[Debit] ,[Credit] ,[ExtraField3] ,[ExtraField2] ,[ExtraField1] ,[AddedBy] ,[AddedDate] ,[UpdatedBy] ,[UpdatedDate] ,[RowStatusID]) VALUES(" + JournalMasterID + "," + ddlFinalProduct.SelectedValue + "," + "9" + "," + ddlWorkSatation.SelectedValue + "," + (totalmoney * decimal.Parse(lblPricePerUnit.Text)).ToString("0.00") + "," + "0" + "," + "''" + "," + "''" + "," + "'" + hfItemID.Value + "'" + "," + getLogin().LoginID + "," + "GETDATE()" + "," + getLogin().LoginID + "," + "GETDATE()" + "," + "1);" ; sql += @"INSERT INTO [ACC_JournalDetail] ([JournalMasterID] ,[ACC_ChartOfAccountLabel4ID] ,[ACC_ChartOfAccountLabel3ID] ,[WorkStation] ,[Debit] ,[Credit] ,[ExtraField3] ,[ExtraField2] ,[ExtraField1] ,[AddedBy] ,[AddedDate] ,[UpdatedBy] ,[UpdatedDate] ,[RowStatusID]) VALUES(" + JournalMasterID + "," + hfRawMaterialID.Value + "," + "7" + "," + ddlWorkSatation.SelectedValue + "," + "0" + "," + (totalmoney * decimal.Parse(lblPricePerUnit.Text)).ToString("0.00") + "," + "''" + "," + "''" + "," + "'" + hfItemID.Value + "'" + "," + getLogin().LoginID + "," + "GETDATE()" + "," + getLogin().LoginID + "," + "GETDATE()" + "," + "1);" ; */ } } } try { if (CommonManager.SQLExec(sql + "select 1;").Tables[0].Rows[0][0].ToString() == "1") { showAlartMessage("Successfully Submitted the wastage"); cearlAlltheControl(); //btnSearch_Click(this, new EventArgs()); } } catch (Exception ex) { showAlartMessage("Someting wrong"); } }
public bool UpdateACC_JournalMaster(ACC_JournalMaster aCC_JournalMaster) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("GP_UpdateACC_JournalMaster", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ACC_JournalMasterID", SqlDbType.Int).Value = aCC_JournalMaster.ACC_JournalMasterID; cmd.Parameters.Add("@JournalMasterName", SqlDbType.NVarChar).Value = aCC_JournalMaster.JournalMasterName; cmd.Parameters.Add("@ExtraField1", SqlDbType.NVarChar).Value = aCC_JournalMaster.ExtraField1; cmd.Parameters.Add("@ExtraField2", SqlDbType.NVarChar).Value = aCC_JournalMaster.ExtraField2; cmd.Parameters.Add("@ExtraField3", SqlDbType.NVarChar).Value = aCC_JournalMaster.ExtraField3; cmd.Parameters.Add("@Note", SqlDbType.NVarChar).Value = aCC_JournalMaster.Note; cmd.Parameters.Add("@JournalDate", SqlDbType.DateTime).Value = aCC_JournalMaster.JournalDate; cmd.Parameters.Add("@AddedBy", SqlDbType.Int).Value = aCC_JournalMaster.AddedBy; cmd.Parameters.Add("@AddedDate", SqlDbType.DateTime).Value = aCC_JournalMaster.AddedDate; cmd.Parameters.Add("@UpdatedBy", SqlDbType.Int).Value = aCC_JournalMaster.UpdatedBy; cmd.Parameters.Add("@UpdatedDate", SqlDbType.DateTime).Value = aCC_JournalMaster.UpdatedDate; cmd.Parameters.Add("@RowStatusID", SqlDbType.Int).Value = aCC_JournalMaster.RowStatusID; connection.Open(); int result = cmd.ExecuteNonQuery(); return result == 1; } }
protected void btnJournalSubmit_Click(object sender, EventArgs e) { List<ACC_HeadType> allACC_HeadType= ACC_HeadTypeManager.GetAllACC_HeadTypes(); foreach (GridViewRow gvr in gvACC_ChartOfAccountLabel3.Rows) { HiddenField hfChartOfAccountLabel3ID = (HiddenField)gvr.FindControl("hfChartOfAccountLabel3ID"); //DropDownList ddlACC_ChartOfAccountLabel4 = (DropDownList)gvr.FindControl("ddlACC_ChartOfAccountLabel4"); Label lblChartOfAccountLabel3Text = (Label)gvr.FindControl("lblChartOfAccountLabel3Text"); Label lblJournalMasterID = (Label)gvr.FindControl("lblJournalMasterID"); TextBox txtAmount = (TextBox)gvr.FindControl("txtAmount"); TextBox txtPayto = (TextBox)gvr.FindControl("txtPayto"); TextBox txtAddress = (TextBox)gvr.FindControl("txtAddress"); TextBox txtNote = (TextBox)gvr.FindControl("txtNote"); TextBox txtCheckDate = (TextBox)gvr.FindControl("txtCheckDate"); TextBox txtCheckNo = (TextBox)gvr.FindControl("txtCheckNo"); TextBox txtBank = (TextBox)gvr.FindControl("txtBank"); if (txtAmount.Text == "0") { continue; } try { ACC_JournalMaster aCC_JournalMaster = new ACC_JournalMaster(); aCC_JournalMaster.JournalMasterName = "2";//Voucher Type aCC_JournalMaster.ExtraField1 = txtPayto.Text; aCC_JournalMaster.ExtraField2 = txtAddress.Text; aCC_JournalMaster.ExtraField3 = ""; aCC_JournalMaster.Note = txtNote.Text; aCC_JournalMaster.JournalDate = DateTime.Parse(txtJournalDate.Text); aCC_JournalMaster.AddedBy = getLogin().LoginID; aCC_JournalMaster.AddedDate = DateTime.Now; aCC_JournalMaster.UpdatedBy = getLogin().LoginID; aCC_JournalMaster.UpdatedDate = DateTime.Now; aCC_JournalMaster.RowStatusID = 1; int JournalMasterID = 0; JournalMasterID = ACC_JournalMasterManager.InsertACC_JournalMaster(aCC_JournalMaster); ACC_JournalDetail aCC_JournalDetail = new ACC_JournalDetail(); aCC_JournalDetail.JournalMasterID = JournalMasterID; //if(ddlACC_ChartOfAccountLabel4.SelectedValue != "0") //{ // aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = Int32.Parse(ddlACC_ChartOfAccountLabel4.SelectedValue); // aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = ddlACC_ChartOfAccountLabel4.SelectedItem.Text; //} //else //{ aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = 0; aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = "N/A"; //} aCC_JournalDetail.ACC_ChartOfAccountLabel3Text = lblChartOfAccountLabel3Text.Text; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = Int32.Parse(hfChartOfAccountLabel3ID.Value); string workStationText = ""; foreach (ACC_HeadType item in allACC_HeadType) { if (item.ACC_HeadTypeID == 1) { workStationText = item.HeadTypeName; break; } } //if (ddlACC_ChartOfAccountLabel4.SelectedItem.Text.Contains(workStationText)) //{ // aCC_JournalDetail.WorkStation = aCC_JournalDetail.ACC_ChartOfAccountLabel4ID; // aCC_JournalDetail.WorkStationName = aCC_JournalDetail.ACC_ChartOfAccountLabel4Text; //} //else //{ aCC_JournalDetail.WorkStation = 1; aCC_JournalDetail.WorkStationName = "Head Office"; //} aCC_JournalDetail.Debit = Decimal.Parse(txtAmount.Text); aCC_JournalDetail.Credit = Decimal.Parse("0"); aCC_JournalDetail.ExtraField3 = ""; aCC_JournalDetail.ExtraField2 = ""; aCC_JournalDetail.ExtraField1 = ""; aCC_JournalDetail.AddedBy = getLogin().LoginID; aCC_JournalDetail.AddedDate = DateTime.Now; aCC_JournalDetail.UpdatedBy = getLogin().LoginID; aCC_JournalDetail.UpdatedDate = DateTime.Now; aCC_JournalDetail.RowStatusID = 1; //For Debit part ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); //For Money Entry aCC_JournalDetail.ACC_ChartOfAccountLabel3Text =""; aCC_JournalDetail.ACC_ChartOfAccountLabel3ID = int.Parse(ddlBalance.SelectedValue.Split('@')[0]); aCC_JournalDetail.ACC_ChartOfAccountLabel4ID = int.Parse(ddlBalance.SelectedValue.Split('@')[1]); aCC_JournalDetail.ACC_ChartOfAccountLabel4Text = ""; aCC_JournalDetail.Debit = 0; aCC_JournalDetail.Credit = Decimal.Parse(txtAmount.Text); aCC_JournalDetail.WorkStation = 1; aCC_JournalDetail.WorkStationName = "Head Office"; aCC_JournalDetail.ExtraField3 = txtCheckNo.Text; aCC_JournalDetail.ExtraField2 = txtBank.Text; aCC_JournalDetail.ExtraField1 = txtCheckDate.Text; ACC_JournalDetailManager.InsertACC_JournalDetail(aCC_JournalDetail); lblJournalMasterID.Text = "<a href='Voucherprint.aspx?JournalMasterID=" + JournalMasterID.ToString() + "' target='_blank'>PV # " + JournalMasterID.ToString() + "</a>"; //showAlartMessage("Successfully Done."); } catch (Exception ex) { lblJournalMasterID.Text = "<span style='color:red;'>Error !!</span>"; //showAlartMessage("Error occured"); } } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (ddlSuppier.SelectedValue == "0") { showAlartMessage("Please select the Supplier"); return; } List <Inv_Item> PurchasedItems = new List <Inv_Item>(); PurchasedItems = loadFromTheGrid(); if (PurchasedItems.Count == 0) { showAlartMessage("Please Add Items"); return; } int JournalMasterID = 0; int pruchseID = 0; if (txtOldPurchaseID.Text == "") { //Insert Purchse Inv_Purchase inv_Purchase = new Inv_Purchase(); inv_Purchase.PurchaseName = ""; inv_Purchase.PurchseDate = DateTime.Parse(txtPurchseDate.Text); inv_Purchase.SuppierID = Int32.Parse(ddlSuppier.SelectedValue); inv_Purchase.InvoiceNo = txtInvoiceNo.Text; inv_Purchase.Particulars = txtParticulars.Text; inv_Purchase.IsPurchase = true; inv_Purchase.WorkSatationID = 2;//Int32.Parse(ddlWorkSatation.SelectedValue); inv_Purchase.ExtraField1 = rbtnlRawmaterialsType.SelectedValue; inv_Purchase.ExtraField2 = ""; inv_Purchase.ExtraField3 = rbtnlPaymentType.SelectedValue; inv_Purchase.ExtraField4 = ""; inv_Purchase.ExtraField5 = ""; inv_Purchase.AddedBy = getLogin().LoginID; inv_Purchase.AddedDate = DateTime.Now; inv_Purchase.UpdatedBy = getLogin().LoginID; inv_Purchase.UpdatedDate = DateTime.Now; inv_Purchase.RowStatusID = 1; pruchseID = Inv_PurchaseManager.InsertInv_Purchase(inv_Purchase); //Journal Entry ACC_JournalMaster aCC_JournalMaster = new ACC_JournalMaster(); aCC_JournalMaster.JournalMasterName = (rbtnlPaymentType.SelectedValue == "Cash" ? "2" : "3");//Journal Voucher aCC_JournalMaster.ExtraField1 = ddlSuppier.SelectedItem.Text; aCC_JournalMaster.ExtraField2 = ""; aCC_JournalMaster.ExtraField3 = ""; aCC_JournalMaster.Note = "Inventory Purchase-" + pruchseID.ToString(); aCC_JournalMaster.JournalDate = DateTime.Parse(txtPurchseDate.Text); aCC_JournalMaster.AddedBy = getLogin().LoginID; aCC_JournalMaster.AddedDate = DateTime.Now; aCC_JournalMaster.UpdatedBy = getLogin().LoginID; aCC_JournalMaster.UpdatedDate = DateTime.Now; aCC_JournalMaster.RowStatusID = 1; JournalMasterID = ACC_JournalMasterManager.InsertACC_JournalMaster(aCC_JournalMaster); //insert each Item CommonManager.SQLExec("Update Inv_Purchase set ExtraField2='" + JournalMasterID.ToString() + "' where Inv_PurchaseID=" + pruchseID.ToString() + "; select 1"); } else { string SQL = "select ACC_JournalMasterID from ACC_JournalMaster where Note='Inventory Purchase-" + txtOldPurchaseID.Text + "'"; try { JournalMasterID = int.Parse(CommonManager.SQLExec(SQL).Tables[0].Rows[0][0].ToString()); pruchseID = int.Parse(txtOldPurchaseID.Text); } catch (Exception ex) { showAlartMessage("Wrong Old PurchaseID"); return; } } foreach (Inv_Item item in PurchasedItems) { item.PurchaseID = pruchseID; item.UpdatedBy = JournalMasterID;//emporary we pass the journal master ID item.ExtraField6 = rbtnlPaymentType.SelectedValue; item.Inv_ItemID = Inv_ItemManager.InsertInv_Item(item); } PurchasedItems = new List <Inv_Item>(); showInv_ItemGrid(PurchasedItems); hlnkPurchasePrint.NavigateUrl = "PurchasePrint.aspx?PurchaseID=" + pruchseID.ToString(); hlnkPurchasePrint.Visible = true; }