public void userpref() { GRPrepDAL objGrprepDAL = new GRPrepDAL(); tblUserPref userpref = objGrprepDAL.selectuserpref(); AmntRecvdAgnst = Convert.ToInt32(userpref.AmntRecvdAgnst_GRInvce); UpdateGr = Convert.ToBoolean(userpref.TBB_Rate); if (string.IsNullOrEmpty(userpref.Menu_FleetMgmt.ToString()) ? false : Convert.ToBoolean(userpref.Menu_FleetMgmt) == true) { liFleetMgmt.Visible = true; } else { liFleetMgmt.Visible = false; } if (string.IsNullOrEmpty(userpref.GRRetRequired.ToString()) ? false : Convert.ToBoolean(userpref.GRRetRequired) == true) { liRetailMast.Visible = liRetailBookEntry.Visible = true; hrfGRConsldRepRetlr.Visible = true; } else { liRetailMast.Visible = liRetailBookEntry.Visible = false; hrfGRConsldRepRetlr.Visible = false; } }
private void PrintGRJainBulk(Int64 GRHeadIdno) { GRPrepDAL obj1 = new GRPrepDAL(); tblUserPref hiduserpref = obj1.selectuserpref(); string CompName = ""; string Add1 = "", Add2 = ""; string PhNo = ""; string City = ""; string State = ""; string PanNo; string TinNo = ""; string ServTaxNo = ""; string email = ""; string FaxNo = ""; string Remark = ""; string DelNoteRef = ""; DataSet CompDetl = SqlHelper.ExecuteDataset(ApplicationFunction.ConnectionString(), CommandType.Text, "select * from tblcompmast"); # region Company Details
private void GRPrep() { Repeater obj = new Repeater(); GRPrepDAL obj1 = new GRPrepDAL(); tblUserPref hiduserpref = obj1.selectuserpref(); double dcmsn = 0, dblty = 0, dcrtge = 0, dsuchge = 0, dwges = 0, dPF = 0, dtax = 0, dtoll = 0, dqty = 0, damnt = 0, dweight = 0; string CompName = ""; string Add1 = "", Add2 = ""; string PhNo = ""; string City = ""; string State = ""; string PanNo; string TinNo = ""; string ServTaxNo = ""; string Through = ""; string FaxNo = ""; string Remark = ""; string DelNoteRef = ""; int iPrintOption, PrintRcptAmnt = 0; string strTermCond = ""; Int32 PriPrinted = 0; Int32 ReportTyp = 0; int compID = 0; string numbertoent = ""; DataSet CompDetl = SqlHelper.ExecuteDataset(ApplicationFunction.ConnectionString(), CommandType.Text, "select * from tblcompmast"); # region Company Details
public void PrintGRPrep(Int64 intGRIdno) { Repeater obj = new Repeater(); GRPrepDAL obj1 = new GRPrepDAL(); tblUserPref hiduserpref = obj1.selectuserpref(); // HidsRenWages.Value = Convert.ToString(hiduserpref.WagesLabel_Print); if (hiduserpref.Logo_Req == true && hiduserpref.Logo_Image != null) { imgLogoShow.Visible = true; byte[] img = hiduserpref.Logo_Image; string base64String = Convert.ToBase64String(img, 0, img.Length); imgLogoShow.ImageUrl = "data:image/png;base64," + base64String; } else { imgLogoShow.Visible = false; imgLogoShow.ImageUrl = ""; } if (Convert.ToString(hiduserpref.Terms) == "" && Convert.ToString(hiduserpref.Terms1) == "") { lblTerms.Visible = false; lblterms1.Visible = false; } else { lblTerms.Visible = true; lblterms1.Visible = true; lblTerms.Text = "'" + hiduserpref.Terms + "'"; lblterms1.Text = hiduserpref.Terms1; } double dcmsn = 0, dblty = 0, dcrtge = 0, dsuchge = 0, dwges = 0, dPF = 0, dtax = 0, dtoll = 0, dqty = 0, damnt = 0, dweight = 0; string CompName = ""; string Add1 = "", Add2 = ""; string PhNo = ""; string City = ""; string State = ""; string PanNo; string TinNo = ""; string ServTaxNo = ""; string Through = ""; string FaxNo = ""; string Remark = ""; string DelNoteRef = ""; int iPrintOption, PrintRcptAmnt = 0; string strTermCond = ""; Int32 PriPrinted = 0; Int32 ReportTyp = 0; int compID = 0; string numbertoent = ""; string CompGSTIN = ""; string Email = ""; DataSet CompDetl = SqlHelper.ExecuteDataset(ApplicationFunction.ConnectionString(), CommandType.Text, "select * from tblcompmast"); # region Company Details
private void PrintGRPrep(Int64 GRHeadIdno) { visiFalse.Visible = false; Repeater obj = new Repeater(); GRPrepDAL obj1 = new GRPrepDAL(); tblUserPref hiduserpref = obj1.selectuserpref(); HidsRenWages.Value = Convert.ToString(hiduserpref.WagesLabel_Print); hidRenamePF.Value = Convert.ToString(hiduserpref.PFLabel_GR); hidRenameToll.Value = Convert.ToString(hiduserpref.TollTaxLabel_GR); HidsRenCartage.Value = Convert.ToString(hiduserpref.CartageLabel_GR); HidRenCommission.Value = Convert.ToString(hiduserpref.CommissionLabel_Gr); HidRenBilty.Value = Convert.ToString(hiduserpref.BiltyLabel_GR); //if (hiduserpref.Logo_Req == true && hiduserpref.Logo_Image != null) //{ // imgLogoShow.Visible = true; // byte[] img = hiduserpref.Logo_Image; // string base64String = Convert.ToBase64String(img, 0, img.Length); // imgLogoShow.ImageUrl = "data:image/png;base64," + base64String; //} //else //{ // imgLogoShow.Visible = false; // imgLogoShow.ImageUrl = ""; //} //if (Convert.ToString(hiduserpref.Terms) == "" && Convert.ToString(hiduserpref.Terms1) == "") //{ // lblTerms.Visible = false; // lblterms1.Visible = false; //} //else //{ // lblTerms.Visible = true; // lblterms1.Visible = true; // lblTerms.Text = "'" + hiduserpref.Terms + "'"; // lblterms1.Text = hiduserpref.Terms1; //} if (Convert.ToString(HidsRenWages.Value) != "") { lblUnloadingPrint.Text = Convert.ToString(HidsRenWages.Value); labHam.Text = Convert.ToString(HidsRenWages.Value); } else { lblUnloadingPrint.Text = "Wages"; labHam.Text = "Wages"; } if (Convert.ToString(hidRenamePF.Value) != "") { lblCollChargePrint.Text = Convert.ToString(hidRenamePF.Value); labCollCha.Text = Convert.ToString(hidRenamePF.Value); } else { lblCollChargePrint.Text = "PF"; labCollCha.Text = "PF"; } if (Convert.ToString(hidRenameToll.Value) != "") { lblDelChargesPrint.Text = Convert.ToString(hidRenameToll.Value); labDelCha.Text = Convert.ToString(hidRenameToll.Value); } else { lblDelChargesPrint.Text = "Toll Tax"; labDelCha.Text = "Toll Tax"; } if (Convert.ToString(HidsRenCartage.Value) != "") { lblFOVPrint.Text = Convert.ToString(HidsRenCartage.Value); labFOV.Text = Convert.ToString(HidsRenCartage.Value); } else { lblFOVPrint.Text = "Cartage"; labFOV.Text = "Cartage"; } if (Convert.ToString(HidRenCommission.Value) != "") { lblOctroiPrint.Text = Convert.ToString(HidRenCommission.Value); labOctroi.Text = Convert.ToString(HidRenCommission.Value); } else { lblOctroiPrint.Text = "Commission"; labOctroi.Text = "Commission"; } if (Convert.ToString(HidRenBilty.Value) != "") { lblDemuChargesPrint.Text = Convert.ToString(HidRenBilty.Value); labDemCha.Text = Convert.ToString(HidRenBilty.Value); } else { labDemCha.Text = "Bilty"; lblDemuChargesPrint.Text = "Bilty"; } double dcmsn = 0, dblty = 0, dcrtge = 0, dsuchge = 0, dwges = 0, dPF = 0, dtax = 0, dtoll = 0, dqty = 0, damnt = 0, dweight = 0; string CompName = "", CompDesc = ""; string Add1 = "", Add2 = ""; string PhNo = ""; string City = ""; string State = ""; string PanNo; string TinNo = ""; string ServTaxNo = ""; string Through = ""; string FaxNo = ""; string Remark = ""; string DelNoteRef = ""; int iPrintOption, PrintRcptAmnt = 0; string strTermCond = ""; Int32 PriPrinted = 0; Int32 ReportTyp = 0; int compID = 0; string numbertoent = ""; string RegNo = ""; DataSet CompDetl = SqlHelper.ExecuteDataset(ApplicationFunction.ConnectionString(), CommandType.Text, "select * from tblcompmast"); # region Company Details
private void PrintGRPrep(Int64 GRHeadIdno) { Repeater obj = new Repeater(); GRPrepDAL obj1 = new GRPrepDAL(); tblUserPref hiduserpref = obj1.selectuserpref(); lblConsigneeGSTIN.Text = "'" + hiduserpref.Terms + "'"; lblConsigneeGSTIN.Text = hiduserpref.Terms1; double dcmsn = 0, dblty = 0, dcrtge = 0, dsuchge = 0, dwges = 0, dPF = 0, dtax = 0, dtoll = 0, dqty = 0, damnt = 0, dweight = 0; string CompName = ""; string Add1 = "", Add2 = ""; string PhNo = ""; string City = ""; string State = ""; string PanNo; string TinNo = ""; string ServTaxNo = ""; string Through = ""; string FaxNo = ""; string Remark = ""; string DelNoteRef = ""; int iPrintOption, PrintRcptAmnt = 0; string strTermCond = ""; Int32 PriPrinted = 0; Int32 ReportTyp = 0; int compID = 0; string numbertoent = ""; GRPrepRetailerDAL objGRRet = new GRPrepRetailerDAL(); DataTable dt = objGRRet.SelectGRPrintKajaria(ApplicationFunction.ConnectionString(), GRHeadIdno); //DataSet dsReport = SqlHelper.ExecuteDataset(ApplicationFunction.ConnectionString(), CommandType.Text, "EXEC [spGRPrep] @ACTION='SelectKajariaPrint',@Id='" + GRHeadIdno + "'"); if (dt != null && dt.Rows.Count > 0) { lblGRNo.Text = Convert.ToString(dt.Rows[0]["GrRet_No"]); lblDate.Text = Convert.ToDateTime(dt.Rows[0]["GrRet_Date"]).ToString("dd-MM-yyyy"); lblFromCity.Text = Convert.ToString(dt.Rows[0]["From_City"]); lblToCity.Text = Convert.ToString(dt.Rows[0]["To_City"]); lblConsigneeName.Text = Convert.ToString(dt.Rows[0]["Sender"]); lblConsigneeGSTIN.Text = Convert.ToString(dt.Rows[0]["SenderGSTIN"]); lblConsignorName.Text = Convert.ToString(dt.Rows[0]["Receiver"]); lblConsignorGSTIN.Text = Convert.ToString(dt.Rows[0]["ReceiverGSTIN"]); lblRemark.Text = Convert.ToString(dt.Rows[0]["Remark"]); lblDelvryPlace.Text = Convert.ToString(dt.Rows[0]["Delivery_Place"]); lblValue.Text = Convert.ToString(dt.Rows[0]["Value"]); lblRefInvNo.Text = Convert.ToString(dt.Rows[0]["Ref_No"]); lblFreight.Text = string.Format("{0:0,0.00}", Convert.ToDouble(dt.Rows[0]["Gross_Amnt"])); lblSurcharge.Text = string.Format("{0:0,0.00}", Convert.ToDouble(dt.Rows[0]["Stcharg_Amnt"])); lblLabour.Text = "0"; lblPickUp.Text = "0"; lblLocalFreight.Text = "0"; lblBilty.Text = string.Format("{0:0,0.00}", Convert.ToDouble(dt.Rows[0]["Bilty_Amnt"])); lblDoorDel.Text = "0"; lblTotal.Text = string.Format("{0:0,0.00}", Convert.ToDouble(dt.Rows[0]["Total_Amnt"])); lblValue.Text = "0"; GSTIdno = dt.Rows[0]["GST_Idno"].ToString(); if (GSTIdno != String.Empty && GSTIdno == "1") { SGSTPer = string.Format("{0:0,0.00}", Convert.ToDouble(dt.Rows[0]["SGST_per"])); CGSTPer = string.Format("{0:0,0.00}", Convert.ToDouble(dt.Rows[0]["CGST_Per"])); SGSTAmt = string.Format("{0:0,0.00}", Convert.ToDouble(dt.Rows[0]["SGST_Amt"])); CGSTAmt = string.Format("{0:0,0.00}", Convert.ToDouble(dt.Rows[0]["CGST_Amt"])); lblGST.Text = (Convert.ToDouble(SGSTAmt == "" ? "0" : SGSTAmt) + Convert.ToDouble(CGSTAmt == "" ? "0" : CGSTAmt)).ToString("N2"); } if (GSTIdno != String.Empty && GSTIdno == "2") { IGSTPer = string.Format("{0:0,0.00}", Convert.ToDouble(dt.Rows[0]["IGST_Per"])); IGSTAmt = string.Format("{0:0,0.00}", Convert.ToDouble(dt.Rows[0]["IGST_Amt"])); lblGST.Text = (Convert.ToDouble(IGSTAmt == "" ? "0" : IGSTAmt)).ToString("N2"); } if (GSTIdno != String.Empty && GSTIdno == "3") { UGSTPer = string.Format("{0:0,0.00}", Convert.ToDouble(dt.Rows[0]["UGST_Per"])); UGSTAmt = string.Format("{0:0,0.00}", Convert.ToDouble(dt.Rows[0]["UGST_Amt"])); lblGST.Text = (Convert.ToDouble(UGSTAmt == "" ? "0" : UGSTAmt)).ToString("N2"); } lblGrossTotal.Text = string.Format("{0:0,0.00}", Convert.ToDouble(dt.Rows[0]["Gross_Amnt"])); Repeater1.DataSource = dt; Repeater1.DataBind(); } }
protected void lnkbtnSave_OnClick(object sender, EventArgs e) { #region Validation Messages for Challan Details if (ddlTranspoter.SelectedIndex == 0) { this.ShowMessage("Please select Transporter."); ddlTranspoter.Focus(); return; } if (ddlTruckNo.SelectedIndex == 0) { this.ShowMessage("Please select Truck No."); ddlTruckNo.Focus(); return; } if (txtchlnRef.Text == "") { this.ShowMessage("Please Enter Challan Ref.No ."); ddlTruckNo.Focus(); return; } string msg = ""; dtTemp = (DataTable)ViewState["dt"]; if (dtTemp != null) { if (dtTemp.Rows.Count <= 0) { ShowMessage("Please enter details"); return; } } if (grdMain.Rows.Count <= 0) { ShowMessage("Please enter details"); return; } #endregion #region Declare Input Variables for Challan Details //string strMsg = string.Empty; //Int64 intGrPrepIdno = 0; //Int32 YearIdno = Convert.ToInt32(ddldateRange.SelectedValue) == -1 ? 0 : Convert.ToInt32(ddldateRange.SelectedValue); //DateTime strChallanDate = Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDate.Text.Trim().ToString())); //Int64 intChallanNo = string.IsNullOrEmpty(txtchallanNo.Text.Trim()) ? 0 : Convert.ToInt64(txtchallanNo.Text.Trim()); //Int32 intTranspoter = string.IsNullOrEmpty(ddlTranspoter.SelectedValue) ? 0 : Convert.ToInt32(ddlTranspoter.SelectedValue); //Int32 TruckNoIdno = string.IsNullOrEmpty(ddlTruckNo.SelectedValue) ? 0 : Convert.ToInt32(ddlTruckNo.SelectedValue); //Int32 strChlnRefno = string.IsNullOrEmpty(txtchlnRef.Text) ? 0 : Convert.ToInt32(txtchlnRef.Text); //DateTime? dtInstDate; //if (txtInstDate.Text == "") //{ // dtInstDate = null; //} //else //{ // dtInstDate = Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtInstDate.Text)); //} #endregion #region Insert/Update with Transaction using (TransactionScope tScope = new TransactionScope(TransactionScopeOption.Required)) { string intGrPrepIdno = ""; string ChlnNo = txtchallanNo.Text; Int32 TrunckIdno = Convert.ToInt32(ddlTruckNo.SelectedValue); Int32 YearIdno = Convert.ToInt32((ddldateRange.SelectedIndex < 0) ? "0" : ddldateRange.SelectedValue); GRPrepDAL objDAL = new GRPrepDAL(); isTBBRate = objDAL.SelectTBBRate(); tblUserPref userpref = objDAL.selectuserpref(); itruckcitywise = Convert.ToInt32(userpref.Work_Type); DataTable dtDetail = (DataTable)ViewState["dt"]; try { ChlnBookingCrsngDAL obj = new ChlnBookingCrsngDAL(); tblChlnBookHead objtblChlnBookHead = new tblChlnBookHead(); objtblChlnBookHead.Chln_No = txtchallanNo.Text; objtblChlnBookHead.Chln_Date = Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDate.Text)); objtblChlnBookHead.BaseCity_Idno = Convert.ToInt32((DdlfromcityHead.SelectedIndex <= 0) ? "0" : DdlfromcityHead.SelectedValue); objtblChlnBookHead.DelvryPlc_Idno = Convert.ToInt32(0); objtblChlnBookHead.Truck_Idno = Convert.ToInt32((ddlTruckNo.SelectedIndex <= 0) ? "0" : ddlTruckNo.SelectedValue); objtblChlnBookHead.Year_Idno = Convert.ToInt32((ddldateRange.SelectedIndex < 0) ? "0" : ddldateRange.SelectedValue); objtblChlnBookHead.Driver_Idno = Convert.ToInt32(1); objtblChlnBookHead.Delvry_Instrc = ""; objtblChlnBookHead.Inv_Idno = 0; objtblChlnBookHead.Gross_Amnt = Convert.ToDouble(txtgrossAmnt.Text); objtblChlnBookHead.Commsn_Amnt = Convert.ToDouble(0.00); objtblChlnBookHead.Transprtr_Idno = Convert.ToInt32(ddlTranspoter.SelectedValue); objtblChlnBookHead.Chln_type = 2; objtblChlnBookHead.Net_Amnt = Convert.ToDouble(txtNetAmnt.Text); objtblChlnBookHead.Other_Amnt = Convert.ToDouble(txtKattAmnt.Text); objtblChlnBookHead.Work_type = Convert.ToInt32(hidWorkType.Value); objtblChlnBookHead.Ref_No = Convert.ToString(txtchlnRef.Text); objtblChlnBookHead.Adv_Amnt = Convert.ToDouble(0.00); objtblChlnBookHead.RcptType_Idno = Convert.ToInt32(1); objtblChlnBookHead.Bank_Idno = Convert.ToInt32(0); objtblChlnBookHead.Inst_No = Convert.ToInt32(0); objtblChlnBookHead.Inst_Dt = Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDate.Text)); objtblChlnBookHead.Date_Added = Convert.ToDateTime(DateTime.Now); Int64 value = 0; if (string.IsNullOrEmpty(hidid.Value) == true) { if (grdMain.Rows.Count > 0 && dtTemp != null && dtTemp.Rows.Count > 0) { ChlnBookingCrsngDAL obj1 = new ChlnBookingCrsngDAL(); intGrPrepIdno = obj1.InsertGR(ChlnNo, TrunckIdno, YearIdno, isTBBRate, itruckcitywise, dtDetail); obj1 = null; } value = obj.Insert(objtblChlnBookHead, dtTemp, intGrPrepIdno); // obj = null; } else { using (TransportMandiEntities db = new TransportMandiEntities(MultipleDBDAL.strDynamicConString())) { db.Connection.Open(); Int32 ChlnIdno = Convert.ToInt32(hidid.Value); TblGrHead GrHEad = db.TblGrHeads.Where(rd => rd.Chln_Idno == ChlnIdno).FirstOrDefault(); List <TblGrDetl> GrDetl = db.TblGrDetls.Where(rd => rd.GrHead_Idno == GrHEad.GR_Idno).ToList(); foreach (TblGrDetl rgd in GrDetl) { db.TblGrDetls.DeleteObject(rgd); db.SaveChanges(); } db.TblGrHeads.DeleteObject(GrHEad); db.SaveChanges(); db.Connection.Close(); } if (grdMain.Rows.Count > 0 && dtTemp != null && dtTemp.Rows.Count > 0) { ChlnBookingCrsngDAL obj1 = new ChlnBookingCrsngDAL(); intGrPrepIdno = obj1.InsertGR(ChlnNo, TrunckIdno, YearIdno, isTBBRate, itruckcitywise, dtDetail); obj1 = null; } value = obj.Update(objtblChlnBookHead, Convert.ToInt32(hidid.Value), dtTemp, intGrPrepIdno); } if (value > 0) { tScope.Complete(); } if (value > 0 && (string.IsNullOrEmpty(hidid.Value) == false)) { ShowMessage("Record Update successfully"); Response.Redirect("ChlnBookingCrsng.aspx", false); } else if (value == -1) { ShowMessage("Challan No Already Exist"); } else { ShowMessage("Record Not Update"); } if (value > 0 && (string.IsNullOrEmpty(hidid.Value) == true)) { ShowMessage("Record saved Successfully "); Response.Redirect("ChlnBookingCrsng.aspx", false); } else if (value == -1) { tScope.Dispose(); ShowMessage("Challan No Already Exist"); } else { ShowMessage("Record Not saved Successfully "); } } catch (Exception Ex) { tScope.Dispose(); } #endregion } }