private void SetDataInControls(Acc_Voucher aV) { try { txtVoucher.Text = aV.VoucherNo; txtVoucherDate_nc.Text = aV.VoucherDate == DateTime.MinValue ? string.Empty : aV.VoucherDate.ToString(StaticInfo.GridDateFormatAcc); ddlCompany_nc.SelectedValue = aV.OrgKey.ToString(); if (aV.VoucherTypeKey != 0) { ddlVoucherType_nc.SelectedValue = ddlVoucherType_nc.Items.FindByValue(aV.VoucherTypeKey.ToString()) == null ? "" : ddlVoucherType_nc.Items.FindByValue(aV.VoucherTypeKey.ToString()).Value; } if (ddlVoucherType_nc.SelectedItem.Text == "BP" || ddlVoucherType_nc.SelectedItem.Text == "BR") { txtChequeNo.Text = aV.CheckNo; if (aV.CheckDate.IsNotNull()) { txtChequeDate.Text = aV.CheckDate.ToStringOrDefault(StaticInfo.GridDateFormat, null); } txtChequeNo.Enabled = true; txtChequeDate.Enabled = true; } else { txtChequeNo.Enabled = false; txtChequeDate.Enabled = false; } txtPayeeOrRecipient.Text = aV.PayRec; txtVoucherDescription.Text = aV.VoucherDesc; txtChequeNo.Text = aV.CheckNo; } catch (Exception ex) { throw (ex); } }
private void SetDataFromControlToObject(ref CustomList <Acc_Voucher> lstAccVoucher) { try { Acc_Voucher obj = lstAccVoucher[0]; obj.VoucherNo = ""; obj.VoucherDate = txtVoucherDate_nc.Text.ToDateTime(StaticInfo.GridDateFormatAcc); obj.OrgKey = ddlCompany_nc.SelectedValue.ToInt(); obj.VoucherTypeKey = 5; //obj.PayRec = txtPayeeOrRecipient.Text; obj.VoucherDesc = txtVoucherDescription.Text; obj.EntryUserKey = CurrentUserSession.UserKey; obj.EntryDate = DateTime.Now; obj.CheckNo = txtChequeNo.Text; if (!string.IsNullOrEmpty(txtChequeDate.Text)) { obj.CheckDate = txtChequeDate.Text.ToDateTime(StaticInfo.GridDateFormat); } else { obj.CheckDate = null; } obj.DField_1 = null; obj.DField_2 = null; } catch (Exception ex) { throw (ex); } }
//btnAddOrEdit_Click protected void btnSave_Click(object sender, EventArgs e) { try { Decimal totalDr = 0.0M; Decimal totalCr = 0.0M; CustomList <Acc_Voucher> lstAccVoucher = AccVoucherList; if (lstAccVoucher.Count == 0) { Acc_Voucher newVoucher = new Acc_Voucher(); lstAccVoucher.Add(newVoucher); } SetDataFromControlToObject(ref lstAccVoucher); CustomList <Acc_VoucherDet> lstAccVoucherDet = (CustomList <Acc_VoucherDet>)Session["PFVoucher_AccVoucherDetList"]; CustomList <Acc_VoucherDet> lstAccVoucherDetAdded = lstAccVoucherDet.FindAll(f => f.IsAdded); CustomList <Acc_VoucherDet> lstAccVoucherDetUpdated = lstAccVoucherDet.FindAll(f => f.IsModified); foreach (Acc_VoucherDet vD in lstAccVoucherDetAdded) { vD.EntryDate = DateTime.Now; vD.EntryUserKey = CurrentUserSession.UserKey; } foreach (Acc_VoucherDet vd in lstAccVoucherDetUpdated) { vd.LastUpdateDate = DateTime.Now; vd.LastUpdateUserKey = CurrentUserSession.UserKey; } foreach (Acc_VoucherDet vD in lstAccVoucherDet) { totalDr += vD.Dr; totalCr += vD.Cr; } if (totalDr == totalCr) { string prifix = ddlVoucherType_nc.SelectedItem.Text; manager.SavePFVoucher(ref lstAccVoucher, ref lstAccVoucherDet, prifix); this.SuccessMessage = (StaticInfo.SavedSuccessfullyMsg + ". Voucher No: " + manager.VoucherID); } else { this.ErrorMessage = ("Dr and Cr must be equal."); return; } btnNew_Click(null, null); } catch (SqlException ex) { this.ErrorMessage = (ExceptionHelper.getSqlExceptionMessage(ex)); } catch (Exception ex) { this.ErrorMessage = (ExceptionHelper.getExceptionMessage(ex)); } }
protected void btnSave_Click(object sender, EventArgs e) { try { CustomList <Acc_Voucher> lstAccVoucher = AccVoucherList; if (lstAccVoucher.Count == 0) { Acc_Voucher newVoucher = new Acc_Voucher(); lstAccVoucher.Add(newVoucher); } SetDataFromControlToObject(ref lstAccVoucher); CustomList <Acc_VoucherDet> lstAccVoucherDet = (CustomList <Acc_VoucherDet>)Session["PFVoucher_AccVoucherDetList"]; if (lstAccVoucherDet.Count == 0) { Acc_VoucherDet voucherDet = new Acc_VoucherDet(); voucherDet.ContactID = Convert.ToInt32(ddlRecipient_nc.SelectedValue); voucherDet.COAKey = Convert.ToInt64(ddlCredit.SelectedValue); voucherDet.Cr = txtCreditAmount.Text.ToDecimal(); voucherDet.EntryDate = DateTime.Now; voucherDet.EntryUserKey = CurrentUserSession.UserKey; voucherDet.Criteria = "Purchase"; lstAccVoucherDet.Add(voucherDet); voucherDet = new Acc_VoucherDet(); // voucherDet.COAKey = Convert.ToInt64(ddlCredit.SelectedValue); voucherDet.ContactID = Convert.ToInt32(ddlRecipient_nc.SelectedValue); voucherDet.Dr = txtCreditAmount.Text.ToDecimal(); voucherDet.EntryDate = DateTime.Now; voucherDet.EntryUserKey = CurrentUserSession.UserKey; voucherDet.Criteria = "Purchase"; lstAccVoucherDet.Add(voucherDet); } else { foreach (Acc_VoucherDet vd in lstAccVoucherDet) { vd.LastUpdateDate = DateTime.Now; vd.LastUpdateUserKey = CurrentUserSession.UserKey; } } string prifix = ddlVoucherType_nc.SelectedItem.Text; manager.SavePFVoucher(ref lstAccVoucher, ref lstAccVoucherDet, prifix); txtVoucher.Text = manager.VoucherID; ddlRecipient_nc_SelectedIndexChanged(null, null); this.SuccessMessage = (StaticInfo.SavedSuccessfullyMsg + ". Voucher No: " + manager.VoucherID); } catch (SqlException ex) { this.ErrorMessage = (ExceptionHelper.getSqlExceptionMessage(ex)); } catch (Exception ex) { this.ErrorMessage = (ExceptionHelper.getExceptionMessage(ex)); } }
private void PopulatePFVoucherInformation(Acc_Voucher aV) { try { SetDataInControls(aV); AccVoucherDetList = manager.GetAllAcc_VoucherDet(aV.VoucherKey); } catch (Exception ex) { throw (ex); } }
protected void btnSave_Click(object sender, EventArgs e) { try { Decimal totalDr = 0.0M; Decimal totalCr = 0.0M; CustomList <Acc_Voucher> lstAccVoucher = AccVoucherList; if (lstAccVoucher.Count == 0) { Acc_Voucher newVoucher = new Acc_Voucher(); lstAccVoucher.Add(newVoucher); } SetDataFromControlToObject(ref lstAccVoucher); CustomList <Acc_VoucherDet> lstAccVoucherDet = AccVoucherDetList; foreach (Acc_VoucherDet vD in lstAccVoucherDet) { totalDr += vD.Dr; totalCr += vD.Cr; } if (totalDr == totalCr) { if (!((PageBase)this.Page).CheckUserAuthentication(lstAccVoucher, lstAccVoucherDet)) { return; } manager.SavePFVoucher(ref lstAccVoucher, ref lstAccVoucherDet, prifix); if (StatusID > 0) { _WF.InsertWorkFlowTransaction(MenuID, StatusID, UserCode, 0, lstAccVoucher[0].VoucherKey, true, "", false, false); } ((PageBase)this.Page).SuccessMessage = (StaticInfo.SavedSuccessfullyMsg + ". Voucher No: " + manager.VoucherID); } else { ((PageBase)this.Page).ErrorMessage = ("Dr and Cr must be equal."); return; } btnNew_Click(null, null); } catch (SqlException ex) { ((PageBase)this.Page).ErrorMessage = (ExceptionHelper.getSqlExceptionMessage(ex)); } catch (Exception ex) { ((PageBase)this.Page).ErrorMessage = (ExceptionHelper.getExceptionMessage(ex)); } }
private void SetDataFromControlToObject(ref CustomList <Acc_Voucher> lstAccVoucher) { try { Acc_Voucher obj = lstAccVoucher[0]; obj.VoucherDate = txtVoucherDate_nc.Text.ToDateTime(StaticInfo.GridDateFormatAcc); obj.OrgKey = Convert.ToInt64(ddlCompany_nc.SelectedValue); obj.VoucherTypeKey = 5; obj.VoucherDesc = txtVoucherDescription.Text; obj.EntryUserKey = CurrentUserSession.UserKey; obj.EntryDate = DateTime.Now; obj.DField_1 = null; obj.DField_2 = null; } catch (Exception ex) { throw (ex); } }
private void PopulatePFVoucherInformation(Acc_Voucher aV) { try { SetDataInControls(aV); AccVoucherDetList = manager.GetAllAcc_VoucherDet(aV.VoucherKey); //if (AccVoucherDetList.Count == 2) //{ // ddlDebit.SelectedValue = AccVoucherDetList[0].COAKey.ToString(); // txtDrAmount.Text = AccVoucherDetList[0].Dr.ToString(); // ddlCredit.SelectedValue = AccVoucherDetList[1].COAKey.ToString(); // txtCreditAmount.Text = AccVoucherDetList[1].Cr.ToString(); //} } catch (Exception ex) { throw (ex); } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack.IsFalse()) { String match = HttpContext.Current.Request.QueryString["Match"]; if (match == "editVoucher") { InitializeCombo(); InitializeSession(); String vocherNo = HttpContext.Current.Request.QueryString["VoucherNo"]; Acc_Voucher item = manager.GetAllAcc_Voucher(vocherNo); CustomList <Acc_Voucher> VoucherList = new CustomList <Acc_Voucher>(); VoucherList.Add(item); AccVoucherList = VoucherList; PopulatePFVoucherInformation(item); } else { InitializeCombo(); btnNew_Click(null, null); } } else { Page.ClientScript.GetPostBackEventReference(this, String.Empty); String eventTarget = Request["__EVENTTARGET"].IsNullOrEmpty() ? String.Empty : Request["__EVENTTARGET"]; if (eventTarget == "SearchPFVoucher") { Acc_Voucher searchAccVoucher = Session[StaticInfo.SearchSessionVarName] as Acc_Voucher; CustomList <Acc_Voucher> VoucherList = new CustomList <Acc_Voucher>(); VoucherList.Add(searchAccVoucher); AccVoucherList = VoucherList; if (searchAccVoucher.IsNotNull()) { PopulatePFVoucherInformation(searchAccVoucher); } } else if (eventTarget == "vou_delete") { btnDelete_Click(null, null); } } }
private void SetDataInControls(Acc_Voucher aV) { try { txtVoucher.Text = aV.VoucherNo; txtVoucherDate_nc.Text = aV.VoucherDate == DateTime.MinValue ? string.Empty : aV.VoucherDate.ToString(STATIC.StaticInfo.GridDateFormat); if (aV.CurrencyID != 0) { ddlCurrencyID.SelectedValue = aV.CurrencyID.ToString(); } txtChequeNo.Text = aV.CheckNo; txtChequeDate.Text = aV.CheckDate == DateTime.MinValue ? string.Empty : aV.CheckDate.ToString(StaticInfo.GridDateFormat); txtVoucherDescription.Text = aV.VoucherDesc; txtChequeNo.Text = aV.CheckNo; } catch (Exception ex) { throw (ex); } }
private void SetDataFromControlToObject(ref CustomList <Acc_Voucher> lstAccVoucher) { try { Acc_Voucher obj = lstAccVoucher[0]; obj.VoucherNo = txtVoucher.Text; obj.VoucherDate = txtVoucherDate_nc.Text.ToDateTime(STATIC.StaticInfo.GridDateFormat); if (ddlCurrencyID.SelectedValue != "") { obj.CurrencyID = ddlCurrencyID.SelectedValue.ToInt(); } obj.VoucherTypeKey = VoucherType; obj.VoucherDesc = txtVoucherDescription.Text; if (prifix == "BP" || prifix == "BR") { obj.CheckNo = txtChequeNo.Text; if (!string.IsNullOrEmpty(txtChequeDate.Text)) { obj.CheckDate = txtChequeDate.Text.ToDateTime(STATIC.StaticInfo.GridDateFormat); } } if (prifix == "BP") { obj.ChequeType = 1; //1 For Issue obj.ChequeStatus = 2; //2 For Issued } if (prifix == "BR") { obj.ChequeType = 2; //2 For Receive obj.ChequeStatus = 3; //3 For Received } } catch (Exception ex) { throw (ex); } }
public CustomList <Acc_Voucher> GetAllAcc_Voucher(Int32 VoucherTypeKey) { return(Acc_Voucher.GetAllAcc_Voucher(VoucherTypeKey)); }
//End //Search Voucher public CustomList <Acc_Voucher> GetAllAcc_VoucherSearch(string searchStr, string blank) { return(Acc_Voucher.GetAllAcc_VoucherSearch(searchStr, blank)); }
public Acc_Voucher GetAllAcc_Voucher(string voucherNo) { return(Acc_Voucher.GetAllAcc_Voucher(voucherNo)); }
public CustomList <Acc_Voucher> GetAllAcc_Voucher() { return(Acc_Voucher.GetAllAcc_Voucher()); }
protected void btnSave_Click(object sender, EventArgs e) { try { CustomList <Acc_Voucher> lstAccVoucher = AccVoucherList; if (lstAccVoucher.Count == 0) { Acc_Voucher newVoucher = new Acc_Voucher(); lstAccVoucher.Add(newVoucher); } SetDataFromControlToObject(ref lstAccVoucher); CustomList <Acc_VoucherDet> lstAccVoucherDet = (CustomList <Acc_VoucherDet>)Session["PFVoucher_AccVoucherDetList"]; if (lstAccVoucherDet.Count == 0) { Acc_VoucherDet voucherDet = new Acc_VoucherDet(); voucherDet.COAKey = Hr_MasterSetup.GetAllHr_MasterSetup("Inventory"); voucherDet.UserKey = Convert.ToInt32(hfEmpKey.Value); voucherDet.Cr = txtCrAmount.Text.ToDecimal(); voucherDet.EntryDate = DateTime.Now; voucherDet.EntryUserKey = CurrentUserSession.UserKey; voucherDet.Criteria = "Sales"; lstAccVoucherDet.Add(voucherDet); voucherDet = new Acc_VoucherDet(); voucherDet.EntryDate = DateTime.Now; voucherDet.COAKey = Hr_MasterSetup.GetAllHr_MasterSetup("Dist Commission"); voucherDet.UserKey = Convert.ToInt32(hfEmpKey.Value); voucherDet.EntryUserKey = CurrentUserSession.UserKey; voucherDet.Cr = txtCommission.Text.ToDecimal(); voucherDet.Criteria = "Sales"; lstAccVoucherDet.Add(voucherDet); voucherDet = new Acc_VoucherDet(); voucherDet.EntryDate = DateTime.Now; voucherDet.COAKey = Hr_MasterSetup.GetAllHr_MasterSetup("VAT"); voucherDet.UserKey = Convert.ToInt32(hfEmpKey.Value); voucherDet.EntryUserKey = CurrentUserSession.UserKey; voucherDet.Cr = txtVAT.Text.ToDecimal(); voucherDet.Criteria = "Sales"; lstAccVoucherDet.Add(voucherDet); voucherDet = new Acc_VoucherDet(); voucherDet.EntryDate = DateTime.Now; voucherDet.COAKey = Hr_MasterSetup.GetAllHr_MasterSetup("GrossSales"); voucherDet.UserKey = Convert.ToInt32(hfEmpKey.Value); voucherDet.EntryUserKey = CurrentUserSession.UserKey; voucherDet.Dr = txtGrossSales.Text.ToDecimal(); voucherDet.Criteria = "Sales"; lstAccVoucherDet.Add(voucherDet); voucherDet = new Acc_VoucherDet(); voucherDet.EntryDate = DateTime.Now; voucherDet.COAKey = Hr_MasterSetup.GetAllHr_MasterSetup("GrossSales"); voucherDet.UserKey = Convert.ToInt32(hfEmpKey.Value); voucherDet.EntryUserKey = CurrentUserSession.UserKey; voucherDet.Cr = txtGrossSales.Text.ToDecimal(); voucherDet.Criteria = "Sales"; lstAccVoucherDet.Add(voucherDet); //Receivable to SO voucherDet = new Acc_VoucherDet(); voucherDet.EntryDate = DateTime.Now; voucherDet.UserKey = Convert.ToInt32(hfEmpKey.Value); voucherDet.EntryUserKey = CurrentUserSession.UserKey; voucherDet.Dr = txtReceivableAmount.Text.ToDecimal(); voucherDet.Criteria = "Sales"; lstAccVoucherDet.Add(voucherDet); //Unilever Commission voucherDet = new Acc_VoucherDet(); voucherDet.EntryDate = DateTime.Now; voucherDet.COAKey = Hr_MasterSetup.GetAllHr_MasterSetup("Commission"); voucherDet.UserKey = Convert.ToInt32(hfEmpKey.Value); voucherDet.EntryUserKey = CurrentUserSession.UserKey; voucherDet.Dr = txtUnileverComm.Text.ToDecimal(); voucherDet.Criteria = "Sales"; lstAccVoucherDet.Add(voucherDet); //Unilever Commission voucherDet = new Acc_VoucherDet(); voucherDet.EntryDate = DateTime.Now; voucherDet.COAKey = Hr_MasterSetup.GetAllHr_MasterSetup("FreeSales"); voucherDet.UserKey = Convert.ToInt32(hfEmpKey.Value); voucherDet.EntryUserKey = CurrentUserSession.UserKey; voucherDet.Dr = txtUnileverFreeSales.Text.ToDecimal(); voucherDet.Criteria = "Sales"; lstAccVoucherDet.Add(voucherDet); } else { foreach (Acc_VoucherDet vd in lstAccVoucherDet) { vd.LastUpdateDate = DateTime.Now; vd.LastUpdateUserKey = CurrentUserSession.UserKey; } } string prifix = "JV"; manager.SavePFVoucher(ref lstAccVoucher, ref lstAccVoucherDet, prifix); this.SuccessMessage = (StaticInfo.SavedSuccessfullyMsg + ". Voucher No: " + manager.VoucherID); txtVoucher.Text = manager.VoucherID; } catch (SqlException ex) { this.ErrorMessage = (ExceptionHelper.getSqlExceptionMessage(ex)); } catch (Exception ex) { this.ErrorMessage = (ExceptionHelper.getExceptionMessage(ex)); } }
public Acc_Voucher GetAllAcc_WorkFlowVoucher(string voucherKey) { return(Acc_Voucher.GetAllAcc_WorkFlowVoucher(voucherKey)); }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack.IsFalse()) { String match = HttpContext.Current.Request.QueryString["Match"]; if (match == "editVoucher") { //InitializeCombo(); //InitializeSession(); //String vocherNo = HttpContext.Current.Request.QueryString["VoucherNo"]; //Acc_Voucher item = manager.GetAllAcc_Voucher(vocherNo); //CustomList<Acc_Voucher> VoucherList = new CustomList<Acc_Voucher>(); //VoucherList.Add(item); //AccVoucherList = VoucherList; //PopulatePFVoucherInformation(item); } else { hfCOAKey.Value = ""; InitializeCombo(); btnNew_Click(null, null); ddlCurrencyID.SelectedValue = "1"; workflow.Visible = false; } } else { Page.ClientScript.GetPostBackEventReference(this, String.Empty); String eventTarget = Request["__EVENTTARGET"].IsNullOrEmpty() ? String.Empty : Request["__EVENTTARGET"]; if (eventTarget == "SearchVoucher") { Acc_Voucher searchAccVoucher = Session[STATIC.StaticInfo.SearchSessionVarName] as Acc_Voucher; CustomList <Acc_Voucher> VoucherList = new CustomList <Acc_Voucher>(); VoucherList.Add(searchAccVoucher); AccVoucherList = VoucherList; if (searchAccVoucher.IsNotNull()) { PopulatePFVoucherInformation(searchAccVoucher); } } else if (eventTarget == "vou_delete") { btnDelete_Click(null, null); } else if (eventTarget == "SearchCOA") { Acc_COA searchCOA = Session[STATIC.StaticInfo.SearchSessionVarName] as Acc_COA; txtHeadCode.Text = searchCOA.COACode; txtHeadName.Text = searchCOA.COAName; hfCOAKey.Value = searchCOA.COAKey.ToString(); } else if (eventTarget == "Test") { String eventArgu = Request["__EVENTARGUMENT"].IsNullOrEmpty() ? String.Empty : Request["__EVENTARGUMENT"]; Acc_Voucher searchAccVoucher = manager.GetAllAcc_WorkFlowVoucher(eventArgu);//Session[STATIC.StaticInfo.SearchSessionVarName] as Acc_Voucher; CustomList <Acc_Voucher> VoucherList = new CustomList <Acc_Voucher>(); VoucherList.Add(searchAccVoucher); AccVoucherList = VoucherList; if (searchAccVoucher.IsNotNull()) { PopulatePFVoucherInformation(searchAccVoucher); } common.Visible = false; workflow.Visible = true; } } }
protected void btnSave_Click(object sender, EventArgs e) { try { CustomList <Acc_VoucherDet> empList = _manager.GetSOList(); //CustomList<Acc_VoucherDet> SOList = _manager.GetSOList(); CustomList <Acc_VoucherDet> VoucherList = new CustomList <Acc_VoucherDet>(); if (errorList.Count != 0) { this.ErrorMessage = "Please Upload Again!"; return; } errorList = new CustomList <ErrorList>(); Int64 freeSales = Hr_MasterSetup.GetAllHr_MasterSetup("FreeSales"); foreach (SalesUploadFromExcel vD in DailySoWiseSalesList) { ErrorList objErrorList = new ErrorList(); try { Acc_VoucherDet obj = empList.Find(f => f.EmpName.Trim() == vD.SOName.Trim()); objErrorList.EmpName = vD.SOName; long cOAKey = manager.GetExistingVoucher(txtVoucherDate_nc.Text.ToString(), Convert.ToInt64(freeSales), Convert.ToInt64(obj.UserKey)); CustomList <Acc_Voucher> lstAccVoucher = new CustomList <Acc_Voucher>(); if (lstAccVoucher.Count == 0) { Acc_Voucher newVoucher = new Acc_Voucher(); if (cOAKey != 0) { newVoucher.SetModified(); } lstAccVoucher.Add(newVoucher); } SetDataFromControlToObject(ref lstAccVoucher); Acc_VoucherDet createVoucher = new Acc_VoucherDet(); createVoucher.COAKey = Hr_MasterSetup.GetAllHr_MasterSetup("GrossSales"); createVoucher.UserKey = obj.UserKey; createVoucher.Dr = vD.Gross; createVoucher.EntryDate = DateTime.Now; createVoucher.EntryUserKey = CurrentUserSession.UserKey; createVoucher.Criteria = "Sales"; if (cOAKey != 0) { createVoucher.SetModified(); } VoucherList.Add(createVoucher); Acc_VoucherDet DistCommissionVoucher = new Acc_VoucherDet(); DistCommissionVoucher.COAKey = Hr_MasterSetup.GetAllHr_MasterSetup("Dist Commission"); DistCommissionVoucher.UserKey = obj.UserKey; DistCommissionVoucher.Cr = vD.DistributorCom; DistCommissionVoucher.EntryDate = DateTime.Now; DistCommissionVoucher.EntryUserKey = CurrentUserSession.UserKey; DistCommissionVoucher.Criteria = "Sales"; if (cOAKey != 0) { DistCommissionVoucher.SetModified(); } VoucherList.Add(DistCommissionVoucher); Acc_VoucherDet VATVoucher = new Acc_VoucherDet(); VATVoucher.COAKey = Hr_MasterSetup.GetAllHr_MasterSetup("VAT"); VATVoucher.UserKey = obj.UserKey; VATVoucher.Cr = vD.VAT; VATVoucher.EntryDate = DateTime.Now; VATVoucher.EntryUserKey = CurrentUserSession.UserKey; VATVoucher.Criteria = "Sales"; if (cOAKey != 0) { VATVoucher.SetModified(); } VoucherList.Add(VATVoucher); Acc_VoucherDet InventoryVoucher = new Acc_VoucherDet(); InventoryVoucher.COAKey = Hr_MasterSetup.GetAllHr_MasterSetup("Inventory"); InventoryVoucher.UserKey = obj.UserKey; InventoryVoucher.Cr = vD.Inventory; InventoryVoucher.EntryDate = DateTime.Now; InventoryVoucher.EntryUserKey = CurrentUserSession.UserKey; InventoryVoucher.Criteria = "Sales"; if (cOAKey != 0) { InventoryVoucher.SetModified(); } VoucherList.Add(InventoryVoucher); Acc_VoucherDet receivableToVoucher = new Acc_VoucherDet(); receivableToVoucher.COAKey = obj.COAKey; receivableToVoucher.UserKey = obj.UserKey; receivableToVoucher.Dr = vD.Cash; receivableToVoucher.EntryDate = DateTime.Now; receivableToVoucher.EntryUserKey = CurrentUserSession.UserKey; receivableToVoucher.Criteria = "Sales"; if (cOAKey != 0) { receivableToVoucher.SetModified(); } VoucherList.Add(receivableToVoucher); Acc_VoucherDet FreeSalesVoucher = new Acc_VoucherDet(); FreeSalesVoucher.COAKey = Hr_MasterSetup.GetAllHr_MasterSetup("FreeSales"); FreeSalesVoucher.UserKey = obj.UserKey; FreeSalesVoucher.Dr = vD.FreeSales; FreeSalesVoucher.EntryDate = DateTime.Now; FreeSalesVoucher.EntryUserKey = CurrentUserSession.UserKey; FreeSalesVoucher.Criteria = "Sales"; if (cOAKey != 0) { FreeSalesVoucher.SetModified(); } VoucherList.Add(FreeSalesVoucher); Acc_VoucherDet CommissionVoucher = new Acc_VoucherDet(); CommissionVoucher.COAKey = Hr_MasterSetup.GetAllHr_MasterSetup("Commission"); CommissionVoucher.UserKey = obj.UserKey; CommissionVoucher.Dr = vD.Commission; CommissionVoucher.EntryDate = DateTime.Now; CommissionVoucher.EntryUserKey = CurrentUserSession.UserKey; CommissionVoucher.Criteria = "Sales"; if (cOAKey != 0) { CommissionVoucher.SetModified(); } VoucherList.Add(CommissionVoucher); //by shantonu Acc_VoucherDet pdCommissionVoucher = new Acc_VoucherDet(); pdCommissionVoucher.COAKey = Hr_MasterSetup.GetAllHr_MasterSetup("PD Commission"); pdCommissionVoucher.UserKey = obj.UserKey; pdCommissionVoucher.Cr = vD.PDC; pdCommissionVoucher.EntryDate = DateTime.Now; pdCommissionVoucher.EntryUserKey = CurrentUserSession.UserKey; pdCommissionVoucher.Criteria = "Sales"; if (cOAKey != 0) { pdCommissionVoucher.SetModified(); } VoucherList.Add(pdCommissionVoucher); Acc_VoucherDet GrossVoucher = new Acc_VoucherDet(); GrossVoucher.COAKey = Hr_MasterSetup.GetAllHr_MasterSetup("GrossSales"); GrossVoucher.UserKey = obj.UserKey; GrossVoucher.Cr = vD.Gross; GrossVoucher.EntryDate = DateTime.Now; GrossVoucher.EntryUserKey = CurrentUserSession.UserKey; GrossVoucher.Criteria = "Sales"; if (cOAKey != 0) { GrossVoucher.SetModified(); } VoucherList.Add(GrossVoucher); string prifix = "JV"; manager.SavePFVoucher(ref lstAccVoucher, ref VoucherList, prifix); objErrorList.Error = "Upload Successfully."; errorList.Add(objErrorList); } catch (SqlException ex) { objErrorList.Error = ExceptionHelper.getSqlExceptionMessage(ex); errorList.Add(objErrorList); } catch (Exception ex) { objErrorList.Error = (ExceptionHelper.getExceptionMessage(ex)); errorList.Add(objErrorList); } // this.SuccessMessage = (StaticInfo.SavedSuccessfullyMsg + ". Voucher No: " + manager.VoucherID); } this.SuccessMessage = ("Sales Upload Compleated. Please See Log File."); } catch (SqlException ex) { this.ErrorMessage = (ExceptionHelper.getSqlExceptionMessage(ex)); } catch (Exception ex) { this.ErrorMessage = (ExceptionHelper.getExceptionMessage(ex)); } }
public CustomList <Acc_Voucher> GetAllAcc_Voucher(Int32 CostCenterID, Int32 BranchOrUnit, Int32 bankBranch, String fromDate, String toDate) { return(Acc_Voucher.GetAllAcc_Voucher(CostCenterID, BranchOrUnit, bankBranch, fromDate, toDate)); }
protected void btnSave_Click(object sender, EventArgs e) { try { CustomList <Acc_Voucher> lstAccVoucher = AccVoucherList; if (lstAccVoucher.Count == 0) { Acc_Voucher newVoucher = new Acc_Voucher(); lstAccVoucher.Add(newVoucher); } SetDataFromControlToObject(ref lstAccVoucher); CustomList <Acc_VoucherDet> lstAccVoucherDet = new CustomList <Acc_VoucherDet>(); if (lstAccVoucherDet.Count == 0) { //Receive From SO Acc_VoucherDet voucherDet = new Acc_VoucherDet(); voucherDet.UserKey = Convert.ToInt32(hfEmpKey.Value); voucherDet.COAKey = Convert.ToInt64(ddlReceiptFromAC_nc.SelectedValue); voucherDet.Cr = txtCreditAmount.Text.ToDecimal(); voucherDet.EntryDate = DateTime.Now; voucherDet.EntryUserKey = CurrentUserSession.UserKey; voucherDet.Criteria = "Sales"; lstAccVoucherDet.Add(voucherDet); //Cash Amount if (txtCashAmount.Text != "") { voucherDet = new Acc_VoucherDet(); voucherDet.UserKey = Convert.ToInt32(hfEmpKey.Value); voucherDet.COAKey = Convert.ToInt64(ddlCashDebit_nc.SelectedValue); voucherDet.Dr = txtCashAmount.Text.ToDecimal(); voucherDet.EntryDate = DateTime.Now; voucherDet.EntryUserKey = CurrentUserSession.UserKey; voucherDet.Criteria = "Sales"; lstAccVoucherDet.Add(voucherDet); } //Bank Amount if (txtBankAmount.Text != "") { voucherDet = new Acc_VoucherDet(); voucherDet.UserKey = Convert.ToInt32(hfEmpKey.Value); voucherDet.COAKey = Convert.ToInt64(ddlBankDeposit_nc.SelectedValue); voucherDet.Dr = txtBankAmount.Text.ToDecimal(); voucherDet.EntryDate = DateTime.Now; voucherDet.EntryUserKey = CurrentUserSession.UserKey; voucherDet.Criteria = "Sales"; lstAccVoucherDet.Add(voucherDet); } } else { foreach (Acc_VoucherDet vd in lstAccVoucherDet) { vd.LastUpdateDate = DateTime.Now; vd.LastUpdateUserKey = CurrentUserSession.UserKey; } } string prifix = "JV"; manager.SavePFVoucher(ref lstAccVoucher, ref lstAccVoucherDet, prifix); this.SuccessMessage = (StaticInfo.SavedSuccessfullyMsg + ". Voucher No: " + manager.VoucherID); btnNew_Click(null, null); txtVoucher.Text = manager.VoucherID; } catch (SqlException ex) { this.ErrorMessage = (ExceptionHelper.getSqlExceptionMessage(ex)); } catch (Exception ex) { this.ErrorMessage = (ExceptionHelper.getExceptionMessage(ex)); } }