protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { AddBlankRowTogvPurchaseProduct(); btnSave.Enabled = true; txtRequisitionDate.Text = string.Format("{0:dd/MM/yyyy}", DateTime.Now); } else { Page.ClientScript.GetPostBackEventReference(this, String.Empty); String eventTarget = Request["__EVENTTARGET"].IsNullOrEmpty() ? String.Empty : Request["__EVENTTARGET"]; if (Request["__EVENTTARGET"] == "SearchPriceSetup") { var requisitionProvider = new EngineeringRequisitionProvider(); string code = Request["__EVENTARGUMENT"]; DataTable dt = requisitionProvider.GetByID(code); if (dt.IsNotNull()) { PopulateControls(dt); gvPurchaseForLSE.DataSource = dt; gvPurchaseForLSE.DataBind(); } btnSave.Visible = false; btnUpdate.Visible = true; } } Session["Value"] = ddlRequisitionDivision.SelectedValue; }
protected void Page_Load(object sender, EventArgs e) { DataTable dt; var reportPath = new ReportPath(); var reportParameter = new ReportParameter(); var reportDocument = new ReportDocument(); int reportType = Request.QueryString["ReportType"].Toint(); DateTime fromDate = Request.QueryString["fromDate"].ToDate(); DateTime toDate = Request.QueryString["toDate"].ToDate(); DateTime aDate = Request.QueryString["aDate"].ToDate(); int reportOption = Request.QueryString["reportOption"].Toint(); int reportCategory = Request.QueryString["reportCategory"].Toint(); int productID = Request.QueryString["productID"].Toint(); var transactionID = Request.QueryString["transactionNo"]; string printOption = Request.QueryString["printOption"]; //******** Updated Datetime ********// DateTime?fDate; DateTime?tDate; DateTime?Date; switch (reportType) { #region Supplier Report case ReportType.SupplierReport: //////////// For Supplier Info report var supplierProvider = new SupplierProvider(); int supplierTypeID = Request.QueryString["SupplierTypeID"].ToInt(); dt = supplierProvider.GetSupplierByTypeID(supplierTypeID); if (dt != null && dt.Rows.Count > 0) { reportDocument.Load(reportPath.SupplierReportPath); GetValue(dt, reportParameter, reportDocument); } else { GetMsg(reportParameter, reportDocument, reportPath); } break; case ReportType.SupplierProductReport: //////////// For Supplier Product report supplierProvider = new SupplierProvider(); int supplierID = Request.QueryString["SupplierID"].ToInt(); dt = supplierProvider.GetByID(supplierID); if (dt != null && dt.Rows.Count > 0) { reportDocument.Load(reportPath.SupplierProductReportPath); GetValue(dt, reportParameter, reportDocument); } else { GetMsg(reportParameter, reportDocument, reportPath); } break; #endregion #region Requisition Report case ReportType.RequisitionReport: //////////// For Requisition report var requisitionProvider = new RequisitionProvider(); fDate = GetNullfDatetime(); tDate = GetNulltDatetime(); Date = GetNullaDatetime(); if (reportOption == 3) { var requisitionNo = Request.QueryString["transactionNo"].Trim(); dt = requisitionProvider.GetByID(requisitionNo); if (dt != null && dt.Rows.Count > 0) { reportDocument.Load(reportPath.RequisitionReportPath); GetValueWithDate(dt, reportParameter, reportDocument); } else { GetMsg(reportParameter, reportDocument, reportPath); } } else { dt = requisitionProvider.GetAllByDateWise(productID, transactionID, fDate, tDate, Date, reportOption); if (dt != null && dt.Rows.Count > 0) { if (reportOption == 2) { reportDocument.Load(reportPath.RequisitionReportPath); GetValueWithFromToDate(reportParameter, reportDocument, dt, fDate, tDate); } else if (reportOption == 1) { reportDocument.Load(reportPath.RequisitionReportPath); GetValueAGetDate(dt, reportParameter, reportDocument, Date); } } else { GetMsg(reportParameter, reportDocument, reportPath); } } break; #endregion #region Purchase Order Report case ReportType.PurchaseOrderReport: //////////// For Purchase Order report var purchaseOrderProvider = new PurchaseOrderProvider(); fDate = GetNullfDatetime(); tDate = GetNulltDatetime(); if (reportCategory == 1) { var purchaseOrderNo = Request.QueryString["transactionNo"].Trim(); dt = purchaseOrderProvider.GetByID(purchaseOrderNo); if (dt != null && dt.Rows.Count > 0) { decimal value = 0.00M; decimal totalValue = 0.00M; foreach (DataRow dr in dt.Rows) { value = Convert.ToDecimal(dr["Value"]); totalValue = totalValue + value; } string textValue = NumberToText(Convert.ToInt32(totalValue), true); System.Data.DataColumn newColumn = new System.Data.DataColumn("TotalAmountInText", typeof(System.String)); newColumn.DefaultValue = textValue; dt.Columns.Add(newColumn); reportDocument.Load(reportPath.PurchaseOrderReportPath); GetValueWithDate(dt, reportParameter, reportDocument); } else { GetMsg(reportParameter, reportDocument, reportPath); } } else if (reportCategory == 2) //// Purchase Order Detail Report - Single Product///////////////////// { dt = purchaseOrderProvider.GetAllData(productID); if (dt != null && dt.Rows.Count > 0) { reportDocument.Load(reportPath.PurchaseOrderDetailReportPath); GetValueWithFromToDate(reportParameter, reportDocument, dt, fDate, tDate); } else { GetMsg(reportParameter, reportDocument, reportPath); } } break; #endregion #region Delivery Challan Report case ReportType.DeliveryChallanReport: //////////// For Delivery Challan Report var deliveryChallanProvider = new DeliveryChallanProvider(); fDate = GetNullfDatetime(); tDate = GetNulltDatetime(); if (reportOption == 2) { var deliveryChallanNo = Request.QueryString["transactionNo"].Trim(); dt = deliveryChallanProvider.GetByID(deliveryChallanNo); if (dt != null && dt.Rows.Count > 0) { reportDocument.Load(reportPath.DeliveryChallanReportPath); GetValueWithDate(dt, reportParameter, reportDocument); } else { GetMsg(reportParameter, reportDocument, reportPath); } } else { //dt = purchaseOrderProvider.GetAllByDateWise(productID, transactionID, fDate, tDate, adate, reportOption); //if (dt != null && dt.Rows.Count > 0) //{ // if (reportOption == 2) // { // reportDocument.Load(reportPath.RequisitionReportPath); // GetValueWithFromToDate(reportParameter, reportDocument, dt, fDate, tDate); // } // else if (reportOption == 1) // { // reportDocument.Load(reportPath.RequisitionReportPath); // GetValueAGetDate(dt, reportParameter, reportDocument, adate); // } //} //else //{ // GetMsg(reportParameter, reportDocument, reportPath); //} } break; #endregion #region Production Requisition Report case ReportType.ProductionRequisitionReport: var productionRequisitionProvider = new ProductionRequisitionProvider(); fDate = GetNullfDatetime(); tDate = GetNulltDatetime(); if (reportOption == 2) { //var prodReqNo = Request.QueryString["transactionNo"].Trim(); //dt = productionRequisitionProvider.GetByID(prodReqNo); //if (dt != null && dt.Rows.Count > 0) //{ // reportDocument.Load(reportPath.ProductionRequisitionReportPath); // GetValueWithDate(dt, reportParameter, reportDocument); //} //else //{ // GetMsg(reportParameter, reportDocument, reportPath); //} } else { } break; #endregion #region Prodct Stock Report case ReportType.ProductCurrentStockReport: var productCurrentStockProvider = new ProductCurrentStockProvider { ProductID = Request.QueryString["ProductID"].ToInt(), DivisionID = Request.QueryString["DivisionID"].ToInt(), ProductType = Request.QueryString["ProductType"].ToInt(), FromDate = Request.QueryString["fromDate"].ToString(), Todate = Request.QueryString["todate"].ToString() }; if (productCurrentStockProvider.ProductID == 0) { dt = productCurrentStockProvider.GetDivisionAndItemwise(); if (dt != null && dt.Rows.Count > 0) { reportDocument.Load(reportPath.AllProductStockReportPath); GetValueWithDate(dt, reportParameter, reportDocument); } else { GetMsg(reportParameter, reportDocument, reportPath); } } else { var mushak16ProviderList = productCurrentStockProvider.GetAll(); if (mushak16ProviderList != null) { reportDocument.Load(reportPath.ProductIndividualStockReportPath); reportDocument.SetDataSource(mushak16ProviderList); GetAddressValue(reportParameter, reportDocument); technoCrystalReport.ReportSource = reportDocument; technoCrystalReport.DataBind(); } else { GetMsg(reportParameter, reportDocument, reportPath); } } break; #endregion #region LC Report case ReportType.LCReport: //////////// For LC report var lCProvider = new LCProvider(); fDate = GetNullfDatetime(); tDate = GetNulltDatetime(); if (reportCategory == 2) /////////////// LC Detail Report /////////////// { dt = lCProvider.GetByDateRangeWise(fromDate, toDate, reportCategory); if (dt != null && dt.Rows.Count > 0) { reportDocument.Load(reportPath.LCDetailReportPath); GetValueWithDate(dt, reportParameter, reportDocument); } else { GetMsg(reportParameter, reportDocument, reportPath); } } else if (reportCategory == 1) //// LC Summary Report ///////////////////// { dt = lCProvider.GetByDateRangeWise(fromDate, toDate, reportCategory); if (dt != null && dt.Rows.Count > 0) { reportDocument.Load(reportPath.LCSummaryReportPath); GetValueWithFromToDate(reportParameter, reportDocument, dt, fDate, tDate); } else { GetMsg(reportParameter, reportDocument, reportPath); } } break; #endregion #region BOE Report case ReportType.BOEReport: //////////// For BOE report var bOEProvider = new BOEProvider(); fDate = GetNullfDatetime(); tDate = GetNulltDatetime(); if (reportCategory == 2) { dt = bOEProvider.GetByDateRangeWise(fromDate, toDate, reportCategory); if (dt != null && dt.Rows.Count > 0) { reportDocument.Load(reportPath.BOEDetailReportPath); GetValueWithDate(dt, reportParameter, reportDocument); } else { GetMsg(reportParameter, reportDocument, reportPath); } } else if (reportCategory == 1) //// BOE Summary Report ///////////////////// { dt = bOEProvider.GetByDateRangeWise(fromDate, toDate, reportCategory); if (dt != null && dt.Rows.Count > 0) { reportDocument.Load(reportPath.BOESummaryReportPath); GetValueWithFromToDate(reportParameter, reportDocument, dt, fDate, tDate); } else { GetMsg(reportParameter, reportDocument, reportPath); } } break; #endregion #region QA Report case ReportType.QAReport: //////////// For QA report var qAQCRequisitionProvider = new QAQCRequisitionProvider(); fDate = GetNullfDatetime(); tDate = GetNulltDatetime(); Date = GetNullaDatetime(); dt = qAQCRequisitionProvider.GetDateWiseProductInfo(fDate, tDate, Date, productID); if (dt != null && dt.Rows.Count > 0) { { //if (reportOption == 1 && adate == null) //All product summary report //{ // reportDocument.Load(reportPath.QAReportPath); // GetValueWithDate(dt, reportParameter, reportDocument); //} //if (reportOption == 1 && adate == null) //All product summary report //{ // reportDocument.Load(reportPath.QAReportPath); // GetValueWithDate(dt, reportParameter, reportDocument); //} if (reportOption == 1) { reportDocument.Load(reportPath.QAReportPath); GetValueAGetDate(dt, reportParameter, reportDocument, Date); } else if (reportOption == 2) { reportDocument.Load(reportPath.QAReportPath); GetValueWithFromToDate(reportParameter, reportDocument, dt, fDate, tDate); } //else if (reportOption == 3) // Purchase ID wise report (showing product details). //{ // reportDocument.Load(reportPath.QAReportPath); // GetValueWithDate(dt, reportParameter, reportDocument, printOption); //} } } else { GetMsg(reportParameter, reportDocument, reportPath); } break; #endregion #region Eng. Internal Requisition Report case ReportType.EngineeringInternalRequiReport: //////////// For Eng Requi report var engRequisitionProvider = new EngineeringRequisitionProvider(); var engRequisitionNo = Request.QueryString["transactionNo"].Trim(); dt = engRequisitionProvider.GetByID(engRequisitionNo); if (dt != null && dt.Rows.Count > 0) { { reportDocument.Load(reportPath.EngInternalRequiReportPath); GetValueWithDate(dt, reportParameter, reportDocument); } } else { GetMsg(reportParameter, reportDocument, reportPath); } break; #endregion } }