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"); } }
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 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 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 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 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; }
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; }