private void btnPrintTag_Click(object sender, EventArgs e) { try { ErrorItem err = CheckCanRunProcess(); if (err != null) { MessageDialog.ShowBusiness(this, err.Message); this.Close(); return; } try { if (txtPreProcessBy.Text.Trim().Length == 0) { MessageDialog.ShowBusiness(this , new EVOFramework.Message(TKPMessages.eValidate.VLM0086.ToString())); return; } ReportBIZ biz = new ReportBIZ(); DataSet ds = biz.LoadStockTakingTagSummary(); if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { string strReportFileName = @"Report\STR040_StockTakingTagSummary.rpt"; RPT999_PreviewReport preview = new RPT999_PreviewReport( Path.Combine(Application.StartupPath, strReportFileName) ); preview.SetDataSource(ds); preview.ReportDoc.SetParameterValue("USER", Common.CurrentUserInfomation.Username.ToString().ToUpper()); preview.ShowPreview(); } else { MessageDialog.ShowInformation(this, null, Message.LoadMessage(TKPMessages.eInformation.INF0001.ToString()).MessageDescription); } } catch (Exception ex) { MessageDialog.ShowBusiness(this, ex.Message); } } catch (Exception ex) { MessageDialog.ShowBusiness(this, ex.Message); } }
private DataSet GetExportTable(StockTakingDTO argSTK) { DataSet ds = null; ReportBIZ biz = new ReportBIZ(); ds = biz.LoadStockCountingResultForExport(argSTK); return(ds); }
private DataSet GetReportTable(StockTakingDTO argSTK) { DataSet ds = null; ReportBIZ biz = new ReportBIZ(); if (rdoReportCountingResult.Checked) { ds = biz.LoadStockCountingResult(argSTK); } else { ds = biz.LoadStockCheckingList(argSTK); } return(ds); }
private void ExportOnHandForAccounting() { string strFileName = GenerateFileName("IVR010"); string strTemplateFileName = @"Report\IVR010_InventorySheet.xls"; string strTemplatePath = Path.Combine(Application.StartupPath, strTemplateFileName); string strExportPath = SaveDialogUtil.GetBrowseFileDialogForExport(strFileName); if (!"".Equals(strExportPath)) { ReportBIZ bizReport = new ReportBIZ(); ReportCriteriaDTO.IVR010 objCriteria = new ReportCriteriaDTO.IVR010(); if (this.dtPeriodBegin.Value.HasValue) { objCriteria.YearMonth = this.dtPeriodBegin.Value.Value.ToString("yyyyMM"); } else { objCriteria.YearMonth = DateTime.Today.ToString("yyyyMM"); } DataSet dsIVR010 = bizReport.LoadIVR010_InventorySheet(objCriteria); ExportUtil.Export(dsIVR010, strTemplatePath, strExportPath); MessageDialog.ShowInformation(this, null, new EVOFramework.Message(Messages.eInformation.INF9003.ToString()).MessageDescription); if (File.Exists(strExportPath)) { System.Diagnostics.Process.Start(strExportPath); } } }
private void QueryData() { try { //QueryLunchBiz biz = new QueryLunchBiz(); //QueryLunchDTO a = new QueryLunchDTO(); //a.SQLCommand = "exec __SelectPivot".ToNZString(); //DataSet ds = biz.ExecuteSQLCommand(a); //pivotMPA.DataSource // this solution call connection string from web service (fast but can see user+wpd) //pivotMPA.ConnectionString = RptServ.GetAdoConnectionString(); //pivotMPA.CommandText = Command; // this solution call data from web service (slow but secure) //string strResult = RptServ.LoadPivotData(Command); //if (strResult.StartsWith("Error")) //{ // msgBox msgBox = new msgBox(); // msgBox.MessageNo = "10011"; // msgBox.MessageErr = strResult; // msgBox.ShowDialog(); //} //else //{ //XmlDocument oxmldoc = new XmlDocument(); //oxmldoc.LoadXml(strResult); //oxmldoc.Save(strFileXML); //pivotMPA.ConnectionString = "Provider=MSPersist"; //pivotMPA.CommandText = strFileXML; ReportBIZ biz = new ReportBIZ(); ReportCriteriaDTO.INV060 cri = new ReportCriteriaDTO.INV060(); cri.DateFrom = dtPeriodBegin.Value.Value; cri.DateTo = dtPeriodEnd.Value.Value; DataSet dsData = biz.LoadINV060_ProductionSummaryByItem(cri); if (dsData != null && dsData.Tables.Count > 0) { if (dsData.Tables[0].Rows.Count > m_iErrorRecords) { //Message . show "Error" MessageDialog.ShowBusiness(this, EVOFramework.Message.LoadMessage(TKPMessages.eValidate.VLM0206.ToString(), new object[] { m_iErrorRecords })); return; } if (dsData.Tables[0].Rows.Count > m_iWarningRecords) { MessageDialogResult dr = MessageDialog.ShowConfirmation(this, EVOFramework.Message.LoadMessage(TKPMessages.eConfirm.CFM0011.ToString(), new object[] { m_iWarningRecords }), MessageDialogButtons.YesNo); if (dr != MessageDialogResult.Yes) { return; } } } else { return; } string strDateFrom = dtPeriodBegin.Value.GetValueOrDefault().ToString("yyyyMMdd"); string strDateTo = dtPeriodEnd.Value.GetValueOrDefault().ToString("yyyyMMdd"); pivotMPA.ConnectionString = Common.CurrentDatabase.OleDbConnectionString; pivotMPA.CommandText = string.Format("exec S_INV060_ProductionSummaryByItem @pDtm_DateFrom='{0}', @pDtm_DateTo='{1}' ", strDateFrom, strDateTo); //pivotMPA.CommandText = "select * from __ProductionSummary2"; PivotView pView = pivotMPA.ActiveView; PivotFieldSets fSets = pivotMPA.ActiveView.FieldSets; // Add Category to the Row axis and Item to the Column axis // Data Row pView.RowAxis.InsertFieldSet(fSets[eTableColumn.Day.ToString()], 0, true); //pView.RowAxis.InsertFieldSet(fSets[eTableColumn.yyyymm.ToString()], 0, true); //pView.RowAxis.InsertFieldSet(fSets[eTableColumn.yyyy.ToString()], 0, true); pView.RowAxis.InsertFieldSet(fSets[eTableColumn.CustName.ToString()], 0, true); pView.RowAxis.InsertFieldSet(fSets[eTableColumn.PartNo.ToString()], 0, true); pView.RowAxis.InsertFieldSet(fSets[eTableColumn.MasterNo.ToString()], 0, true); // remove subtotal of empFullName //pView.RowAxis.FieldSets[eTableColumn.EmpFullName.ToString()].Fields[eTableColumn.EmpFullName.ToString()].set_Subtotals(0, false); // hidden detail pView.RowAxis.FieldSets[eTableColumn.Day.ToString()].Fields[eTableColumn.Day.ToString()].Expanded = false; //pView.RowAxis.FieldSets[eTableColumn.yyyymm.ToString()].Fields[eTableColumn.yyyymm.ToString()].Expanded = false; //pView.RowAxis.FieldSets[eTableColumn.yyyy.ToString()].Fields[eTableColumn.yyyy.ToString()].Expanded = false; pView.RowAxis.FieldSets[eTableColumn.CustName.ToString()].Fields[eTableColumn.CustName.ToString()].Expanded = false; pView.RowAxis.FieldSets[eTableColumn.PartNo.ToString()].Fields[eTableColumn.PartNo.ToString()].Expanded = false; pView.RowAxis.FieldSets[eTableColumn.MasterNo.ToString()].Fields[eTableColumn.MasterNo.ToString()].Expanded = false; // set size //ResizeGroupFieldSets(pView.RowAxis.FieldSets[eTableColumn.EmpID.ToString()].Fields[eTableColumn.EmpID.ToString()], 62); //ResizeGroupFieldSets(pView.RowAxis.FieldSets[eTableColumn.EmpFullName.ToString()].Fields[eTableColumn.EmpFullName.ToString()], 80); // set font and back color SetFontFieldSets(pView.RowAxis.FieldSets[eTableColumn.Day.ToString()].Fields[eTableColumn.Day.ToString()].SubtotalFont, String.Empty, 0, "Blue", false); pView.RowAxis.FieldSets[eTableColumn.Day.ToString()].Fields[eTableColumn.Day.ToString()].SubtotalBackColor = "#C0FFC0"; //SetFontFieldSets(pView.RowAxis.FieldSets[eTableColumn.yyyymm.ToString()].Fields[eTableColumn.yyyymm.ToString()].SubtotalFont, String.Empty, 0, "Blue", false); //pView.RowAxis.FieldSets[eTableColumn.yyyymm.ToString()].Fields[eTableColumn.yyyymm.ToString()].SubtotalBackColor = "#C0FFC0"; //SetFontFieldSets(pView.RowAxis.FieldSets[eTableColumn.yyyy.ToString()].Fields[eTableColumn.yyyy.ToString()].SubtotalFont, String.Empty, 0, "Blue", false); //pView.RowAxis.FieldSets[eTableColumn.yyyy.ToString()].Fields[eTableColumn.yyyy.ToString()].SubtotalBackColor = "#C0FFC0"; SetFontFieldSets(pView.RowAxis.FieldSets[eTableColumn.CustName.ToString()].Fields[eTableColumn.CustName.ToString()].SubtotalFont, String.Empty, 0, "Blue", false); pView.RowAxis.FieldSets[eTableColumn.CustName.ToString()].Fields[eTableColumn.CustName.ToString()].SubtotalBackColor = "#C0FFC0"; SetFontFieldSets(pView.RowAxis.FieldSets[eTableColumn.PartNo.ToString()].Fields[eTableColumn.PartNo.ToString()].SubtotalFont, String.Empty, 0, "Blue", false); pView.RowAxis.FieldSets[eTableColumn.PartNo.ToString()].Fields[eTableColumn.PartNo.ToString()].SubtotalBackColor = "#C0FFC0"; SetFontFieldSets(pView.RowAxis.FieldSets[eTableColumn.MasterNo.ToString()].Fields[eTableColumn.MasterNo.ToString()].SubtotalFont, String.Empty, 0, "Blue", false); pView.RowAxis.FieldSets[eTableColumn.MasterNo.ToString()].Fields[eTableColumn.MasterNo.ToString()].SubtotalBackColor = "#C0FFC0"; // Data Column pView.ColumnAxis.InsertFieldSet(fSets[eTableColumn.Process.ToString()], 0, true); // set font and back color SetFontFieldSets(pView.ColumnAxis.FieldSets[eTableColumn.Process.ToString()].Fields[eTableColumn.Process.ToString()].SubtotalFont, String.Empty, 0, "Blue", false); pView.ColumnAxis.FieldSets[eTableColumn.Process.ToString()].Fields[eTableColumn.Process.ToString()].SubtotalBackColor = "#C0FFC0"; // Group filter pView.FilterAxis.InsertFieldSet(fSets[eTableColumn.Month.ToString()], 0, true); SetFontFieldSets(pView.FilterAxis.FieldSets[eTableColumn.Month.ToString()].Fields[eTableColumn.Month.ToString()].SubtotalFont, String.Empty, 0, "Blue", false); pView.FilterAxis.InsertFieldSet(fSets[eTableColumn.ItemLevel.ToString()], 0, true); SetFontFieldSets(pView.FilterAxis.FieldSets[eTableColumn.ItemLevel.ToString()].Fields[eTableColumn.ItemLevel.ToString()].SubtotalFont, String.Empty, 0, "Blue", false); //SetFontFieldSets(pView.FilterAxis.FieldSets[eTableColumn.AreaID.ToString()].Fields[eTableColumn.AreaID.ToString()].DetailFont, String.Empty, 0, "Green", true); //pView.FilterAxis.InsertFieldSet(fSets["PositionID"], 0, true); ////pView.FilterAxis.InsertFieldSet(fSets["DeptID"], 0, true); ////pView.FilterAxis.InsertFieldSet(fSets["ProjectGroup"], 0, true); //pView.FilterAxis.InsertFieldSet(fSets["DeptID"], 0, true); //// set font and back color ////SetFontFieldSets(pView.FilterAxis.FieldSets["PositionID"].Fields["PositionID"].SubtotalFont, String.Empty, 0, "Blue", false); ////pView.FilterAxis.FieldSets["PositionID"].Fields["PositionID"].SubtotalBackColor = "#C0FFC0"; ////SetFontFieldSets(pView.FilterAxis.FieldSets["ProjectGroup"].Fields["ProjectGroup"].SubtotalFont, String.Empty, 0, "Blue", false); ////pView.FilterAxis.FieldSets["ProjectGroup"].Fields["ProjectGroup"].SubtotalBackColor = "#C0FFC0"; // Data Detail pView.DataAxis.InsertFieldSet(fSets[eTableColumn.Qty.ToString()], 0, true); pView.DataAxis.FieldSets[eTableColumn.Qty.ToString()].Fields[eTableColumn.Qty.ToString()].NumberFormat = "#,##0.00"; //pView.DataAxis.InsertFieldSet(fSets[eTableColumn.NG.ToString()], 0, true); //pView.DataAxis.FieldSets[eTableColumn.NG.ToString()].Fields[eTableColumn.NG.ToString()].NumberFormat = "#,##0.00"; //pView.DataAxis.InsertFieldSet(fSets[eTableColumn.OK.ToString()], 0, true); //pView.DataAxis.FieldSets[eTableColumn.OK.ToString()].Fields[eTableColumn.OK.ToString()].NumberFormat = "#,##0.00"; //// set size //ResizeDetailFieldSets(pView.DataAxis.FieldSets["LoadUsage"].Fields["LoadUsage"], 50); // insert total of data detail PivotTotal TotalQty; TotalQty = pView.AddTotal("Total Qty", pView.DataAxis.FieldSets[eTableColumn.Qty.ToString()].Fields[0], PivotTotalFunctionEnum.plFunctionSum); TotalQty.NumberFormat = "#,##0;#,##0;"; TotalQty.AutoFit = true; TotalQty.Width = 50; pView.DataAxis.InsertTotal(TotalQty, 0); pView.ExpandDetails = PivotTableExpandEnum.plExpandNever; pView.ExpandMembers = PivotTableExpandEnum.plExpandNever; //PivotTotal TotalNG; //TotalNG = pView.AddTotal("Total NG", pView.DataAxis.FieldSets[eTableColumn.NG.ToString()].Fields[0], PivotTotalFunctionEnum.plFunctionSum); //TotalNG.NumberFormat = "#,##0.00;#,##0.00;"; //TotalNG.AutoFit = true; //TotalNG.Width = 50; //pView.DataAxis.InsertTotal(TotalNG, 0); //pView.ExpandDetails = PivotTableExpandEnum.plExpandNever; //PivotTotal TotalOK; //TotalOK = pView.AddTotal("Total OK", pView.DataAxis.FieldSets[eTableColumn.OK.ToString()].Fields[0], PivotTotalFunctionEnum.plFunctionSum); //TotalOK.NumberFormat = "#,##0.00;#,##0.00;"; //TotalOK.AutoFit = true; //TotalOK.Width = 50; //pView.DataAxis.InsertTotal(TotalOK, 0); //pView.ExpandDetails = PivotTableExpandEnum.plExpandNever; // Remove Blank Data //pView.ColumnAxis.FieldSets[eTableColumn.MonthsName.ToString()].Fields[eTableColumn.MonthsName.ToString()].ExcludedMembers = ""; //caption สำหรับ column / row pView.RowAxis.FieldSets[eTableColumn.Day.ToString()].Fields[eTableColumn.Day.ToString()].Caption = "Day"; pView.RowAxis.FieldSets[eTableColumn.CustName.ToString()].Fields[eTableColumn.CustName.ToString()].Caption = "Customer Name"; pView.RowAxis.FieldSets[eTableColumn.PartNo.ToString()].Fields[eTableColumn.PartNo.ToString()].Caption = "Part No."; pView.RowAxis.FieldSets[eTableColumn.MasterNo.ToString()].Fields[eTableColumn.MasterNo.ToString()].Caption = "Master No."; pView.ColumnAxis.FieldSets[eTableColumn.Process.ToString()].Fields[eTableColumn.Process.ToString()].Caption = "Process"; pView.FilterAxis.FieldSets[eTableColumn.Month.ToString()].Fields[eTableColumn.Month.ToString()].Caption = "Month"; pView.FilterAxis.FieldSets[eTableColumn.ItemLevel.ToString()].Fields[eTableColumn.ItemLevel.ToString()].Caption = "Item Level"; //caption สำหรับ parameter ที่ไม่ได้ใช้ pView.RowAxis.FieldSets[eTableColumn.Day.ToString()].Caption = "Day"; pView.RowAxis.FieldSets[eTableColumn.CustName.ToString()].Caption = "Customer Name"; pView.RowAxis.FieldSets[eTableColumn.PartNo.ToString()].Caption = "Part No."; pView.RowAxis.FieldSets[eTableColumn.MasterNo.ToString()].Caption = "Master No."; pView.ColumnAxis.FieldSets[eTableColumn.Process.ToString()].Caption = "Process"; pView.FilterAxis.FieldSets[eTableColumn.Month.ToString()].Caption = "Month"; pView.FilterAxis.FieldSets[eTableColumn.ItemLevel.ToString()].Caption = "Item Level"; // Display All Items (Include Visible) pView.TotalAllMembers = false; pivotMPA.Visible = true; } catch (Exception ex) { MessageDialog.ShowBusiness(this, ex.Message); } }