using System; using System.Drawing; using System.Collections; using System.ComponentModel; using DevExpress.XtraReports.UI; using PublicLib; using System.Data; using DevExpress.XtraPrinting; using System.IO; using System.Net.Mail; using System.Net.Mime; using System.Net; using System.Net.Security; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Windows.Forms; using AegisImplicitMail; namespace HANMI_SALE { public partial class CostInputReport : DevExpress.XtraReports.UI.XtraReport { private DataTable m_Data; public CostInputReport() { InitializeComponent(); } //납품가, 납품단가 입력되도록, 원가분석 //원가분석에는 비고가 안나오도록 하면됨 //원가분석이 견적서로 견적서가 원가분석으로 //원가분석 27칸 견적 20칸 //전자세금계산서 화면정리 public void SetData(string title, DataRow mRow, DataTable dData) { xrLabel_ORDER_NO.Text = "No : " + UtilClass.toStr(mRow["ORDER_NO"]); xrLabel_ORDER_DATE.Text = UtilClass.toDateTime(mRow["ORDER_DATE"]).ToString("f").Substring(0, 13) + GetWeek(UtilClass.toDateTime(mRow["ORDER_DATE"])); //요일에다 ()넣기 xrLabel_CUST_NM.Text = UtilClass.toStr(mRow["CUST_NM"]); xrLabel_FILE_NM.Text = UtilClass.toStr(mRow["FILE_NM"]); xrLabel_COMP_NM.Text = UtilClass.toStr(ConstClass._USER_INFO["COMP_NM"]); xrLabel_OWNER_NM.Text = UtilClass.toStr(ConstClass._USER_INFO["OWNER_NM"]); xrLabel_BIZ_NO.Text = UtilClass.toStr(ConstClass._USER_INFO["BIZ_NO"]); xrLabel_COMP_ADDR.Text = UtilClass.toStr(ConstClass._USER_INFO["COMP_ADDR"]); xrLabel_COMP_TEL_NO.Text = UtilClass.toStr(ConstClass._USER_INFO["TEL_NO"]); xrLabel_COMP_FAX_NO.Text = UtilClass.toStr(ConstClass._USER_INFO["FAX_NO"]); xrLabel_EMAIL.Text = UtilClass.toStr(ConstClass._USER_INFO["EMAIL"]); m_Data = dData.Copy(); m_Data.Columns.Add("R_NO", typeof(int)); decimal order_qty = 0; decimal curr_my = 0; decimal vat_my = 0; for (int i = 0; i < m_Data.Rows.Count; i++) { if (m_Data.Rows[i].RowState == DataRowState.Deleted) { continue; } m_Data.Rows[i]["R_NO"] = i + 1; order_qty += UtilClass.toDecimal(m_Data.Rows[i]["ORDER_QTY"]); curr_my += UtilClass.toDecimal(m_Data.Rows[i]["CURR_MY"]); vat_my += UtilClass.toDecimal(m_Data.Rows[i]["VAT_MY"]); } int rowcount = m_Data.Rows.Count; if (rowcount < 30) { for (int i = rowcount; i < 30; i++) { DataRow row = m_Data.NewRow(); m_Data.Rows.Add(row); } } xrTableCell_R_NO.DataBindings.Add("Text", m_Data, "R_NO"); xrTableCell_ITEM_NM.DataBindings.Add("Text", m_Data, "ITEM_NM"); xrTableCell_ORDER_NORM.DataBindings.Add("Text", m_Data, "ORDER_NORM"); xrTableCell_LN_RMK.DataBindings.Add("Text", m_Data, "LN_RMK"); xrTableCell_ORDER_QTY.DataBindings.Add("Text", m_Data, "ORDER_QTY", "{0:#,##0}"); xrTableCell_CURR_UNIT_MY.DataBindings.Add("Text", m_Data, "CURR_UNIT_MY", "{0:#,##0}"); xrTableCell_CURR_MY.DataBindings.Add("Text", m_Data, "CURR_MY", "{0:#,##0.##}"); xrTableCell_VAT_MY.DataBindings.Add("Text", m_Data, "VAT_MY", "{0:#,##0}"); xrTableCell_SUM_CURR_MY.Text = curr_my.ToString("n0"); xrTableCell_SUM_VAT_MY.Text = vat_my.ToString("n0"); // xrTableCell_SUM_ORDER_MY.Text = (curr_my + vat_my).ToString("n0"); long sum_long = Convert.ToInt64(curr_my + vat_my); xrLabel_SUM_WORD.Text = Number2Hangle(sum_long) + "원정 ( \\ " + (curr_my + vat_my).ToString("n0") + " )"; this.DataSource = m_Data; CommonPreview form = new CommonPreview(title, true, true); form.SetH1Report(this); form.ShowDialog(); } public static bool ValidateServerCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; } static public string Number2Hangle(long lngNumber) { bool UseDecimal = false; string Sign = ""; int i = 0; int Level = 0; string[] NumberChar = new string[] { "", "일", "이", "삼", "사", "오", "육", "칠", "팔", "구" }; string[] LevelChar = new string[] { "", "십", "백", "천" }; string[] DecimalChar = new string[] { "", "만", "억", "조", "경" }; string strValue = string.Format("{0}", lngNumber); string NumToKorea = Sign; UseDecimal = false; for (i = 0; i < strValue.Length; i++) { Level = strValue.Length - i; if (strValue.Substring(i, 1) != "0") { UseDecimal = true; if (((Level - 1) % 4) == 0) { NumToKorea = NumToKorea + NumberChar[int.Parse(strValue.Substring(i, 1))] + DecimalChar[(Level - 1) / 4]; UseDecimal = false; } else { if (strValue.Substring(i, 1) == "1") { NumToKorea = NumToKorea + LevelChar[(Level - 1) % 4]; } else { NumToKorea = NumToKorea + NumberChar[int.Parse(strValue.Substring(i, 1))] + LevelChar[(Level - 1) % 4]; } } } else { if ((Level % 4 == 0) && UseDecimal) { NumToKorea = NumToKorea + DecimalChar[Level / 4]; UseDecimal = false; } } } return NumToKorea; } private string GetWeek(DateTime dt) { string strDay = ""; switch (dt.DayOfWeek) { case DayOfWeek.Monday: strDay = "(월)"; break; case DayOfWeek.Tuesday: strDay = "(화)"; break; case DayOfWeek.Wednesday: strDay = "(수)"; break; case DayOfWeek.Thursday: strDay = "(목)"; break; case DayOfWeek.Friday: strDay = "(금)"; break; case DayOfWeek.Saturday: strDay = "(토)"; break; case DayOfWeek.Sunday: strDay = "(일)"; break; } return strDay; } } }