Files
Groupware/SubProject/FEQ0000/PurchaseCR/rPurchaseCR.cs
2024-05-08 14:53:55 +09:00

103 lines
3.9 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace FEQ0000.Purchase
{
public partial class rPurchaseCR : Form
{
public rPurchaseCR()
{
InitializeComponent();
Properties.Settings.Default["gwcs"] = FCOMMON.info.CS;
Properties.Settings.Default["EEEntities"] = FCOMMON.info.CS;
}
private void rPurchase_Load(object sender, EventArgs e)
{
EnsureVisibleAndUsableSize();
this.dtSD.Text = DateTime.Now.Year.ToString("0000") + "-01-01";
this.dtED.Text = DateTime.Now.Year.ToString("0000") + "-12-31";
this.rpv1.PageCountMode = Microsoft.Reporting.WinForms.PageCountMode.Actual;
this.rpv1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.FullPage;
//this.rpv1.DisplayMode = Microsoft.Reporting.WinForms.DisplayMode.PrintLayout;
this.cmbReport.SelectedIndex = 0;
//refreshData();
}
private void EnsureVisibleAndUsableSize()
{
var visibleBounds = Screen.GetWorkingArea(this);
var isOutOfView = (Left > visibleBounds.Right) || (Top > visibleBounds.Bottom) ||
(Right < visibleBounds.Left) || (Bottom < visibleBounds.Top);
if (isOutOfView)
{
CenterToScreen();
}
var minW = Math.Max(320, this.MinimumSize.Width);
var minH = Math.Max(240, this.MinimumSize.Height);
if (Width < minW || Height < minH)
{
this.Size = new Size(minW, minH);
}
}
private void btSearch_Click(object sender, EventArgs e)
{
refreshData();
}
void refreshData()
{
this.ta.FillDate(dsPurchase.EETGW_PurchaseCR, dtSD.Text, dtED.Text,FCOMMON.info.Login.gcode);
//Set DataSource
Microsoft.Reporting.WinForms.ReportDataSource DsEQ = new Microsoft.Reporting.WinForms.ReportDataSource();
DsEQ.Name = "DataSet1";
DsEQ.Value = this.dsPurchase.EETGW_PurchaseCR;
switch (this.cmbReport.SelectedIndex)
{
case 0: //사용자 - 월
this.rpv1.LocalReport.ReportEmbeddedResource = "FEQ0000.PurchaseCR.Rpt_PurchaseCR.rdlc";
break;
case 1: //공정 - 월
this.rpv1.LocalReport.ReportEmbeddedResource = "FEQ0000.PurchaseCR.Rpt_PurchasePrcCR.rdlc";
break;
case 2: //프로젝트 - 월
//비고를 짤라서 처리해야한다.
foreach(dsPurchase.EETGW_PurchaseCRRow dr in dsPurchase.EETGW_PurchaseCR)
{
if (dr.IsbigoNull()) dr.bigo = string.Empty;
else
{
dr.bigo = dr.bigo.Split('/')[0].Trim();
}
if(dr.projectidx == -1)
{
dr.state = "비 프로젝트";
}
else
{
dr.state = "프로젝트";
}
if (dr.bigo.isEmpty()) dr.bigo = "(없음)";
}
dsPurchase.EETGW_PurchaseCR.AcceptChanges();
this.rpv1.LocalReport.ReportEmbeddedResource = "FEQ0000.PurchaseCR.Rpt_PurchasePrjCR.rdlc";
break;
}
this.rpv1.LocalReport.DataSources.Clear();
this.rpv1.LocalReport.DataSources.Add(DsEQ);
this.rpv1.RefreshReport();
}
}
}