84 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			84 lines
		
	
	
		
			2.6 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.Threading.Tasks;
 | |
| using System.Windows.Forms;
 | |
| 
 | |
| namespace FEQ0000
 | |
| {
 | |
|     public partial class fPurchaseNRList : Form
 | |
|     {
 | |
|         public fPurchaseNRList(dsPurchase.PurchaseDataTable dt)
 | |
|         {
 | |
|             InitializeComponent();
 | |
|             this.ds1.Purchase.Merge(dt);
 | |
|             this.ds1.AcceptChanges();
 | |
|         }
 | |
| 
 | |
|         private void fEBoardReport_Load(object sender, EventArgs e)
 | |
|         {
 | |
|             //기본엑셀파일을 가져온다
 | |
|             this.Show();
 | |
|             this.bs1.Sort = "sc,sid,pumname";
 | |
|             this.bs1.Filter = "sc <> ''";
 | |
|             Application.DoEvents();
 | |
| 
 | |
|             //파일불러오기
 | |
|             LoadExcel();
 | |
| 
 | |
|             //순번맥기기
 | |
|             var sumamt = ds1.Purchase.Where(t=>t.sc != "").Sum(t => t.pumamt);
 | |
|             for (int r = 0; r < this.fpSpread1.ActiveSheet.RowCount; r++)
 | |
|             {
 | |
|                 fpSpread1.ActiveSheet.Cells[r, 0].Value = r + 1;
 | |
| 
 | |
|             }
 | |
| 
 | |
|             //마지막 한줄 추가하고 합계
 | |
|             fpSpread1.ActiveSheet.AddUnboundRows(fpSpread1.ActiveSheet.RowCount, 1);
 | |
|             fpSpread1.ActiveSheet.Cells[$"J{fpSpread1.ActiveSheet.RowCount}"].Value = sumamt;
 | |
|             fpSpread1.ActiveSheet.Cells[$"B{fpSpread1.ActiveSheet.RowCount}"].Value = "Total";
 | |
|             fpSpread1.ActiveSheet.Cells[$"A{fpSpread1.ActiveSheet.RowCount}:L{fpSpread1.ActiveSheet.RowCount}"].BackColor = Color.FromArgb(220, 220, 220);
 | |
| 
 | |
|         }
 | |
| 
 | |
|         void LoadExcel()
 | |
|         {
 | |
|             //파일불러오기
 | |
|             //var fi = new System.IO.FileInfo(FCOMMON.Util.CurrentPath + "EBoardReport.xlsx");
 | |
|             //this.fpSpread1.OpenExcel(fi.FullName);
 | |
|         }
 | |
| 
 | |
|         private void btRefresh_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             this.ds1.RejectChanges();
 | |
|             this.fpSpread1.Invalidate();
 | |
|         }
 | |
| 
 | |
|         private void btSave_Click(object sender, EventArgs e)
 | |
|         {
 | |
| 
 | |
|         }
 | |
| 
 | |
|         private void panel1_MouseDoubleClick(object sender, MouseEventArgs e)
 | |
|         {
 | |
|             LoadExcel();
 | |
|         }
 | |
| 
 | |
|         private void toolStripButton1_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             //파일저장
 | |
|             var sd = new SaveFileDialog();
 | |
|             sd.Filter = "excel|*.xls";
 | |
|             if (sd.ShowDialog() == DialogResult.OK)
 | |
|             {
 | |
|                 this.fpSpread1.SaveExcel(sd.FileName, FarPoint.Excel.ExcelSaveFlags.SaveBothCustomRowAndColumnHeaders);
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| }
 | 
