This commit is contained in:
chi
2024-01-16 10:09:25 +09:00
parent d76b40ddf0
commit c2be3da94a
40 changed files with 3288 additions and 2627 deletions

View File

@@ -40,6 +40,7 @@ namespace FEQ0000
this.bs.DataSource = rows;
this.dataGridView1.DataError += (s1, e1) => { };
this.dataGridView1.EditMode = DataGridViewEditMode.EditOnKeystroke;
}
private void FPurchase_FormClosing(object sender, FormClosingEventArgs e)
@@ -312,11 +313,6 @@ namespace FEQ0000
}
private void toolStripButton3_Click(object sender, EventArgs e)
{
}
private void bs_CurrentChanged(object sender, EventArgs e)
{
var dr = bs.Current as dsPurchase.PurchaseRow;
@@ -326,10 +322,6 @@ namespace FEQ0000
//else richTextBox2.Text = dr.bigo;
}
private void toolStripButton4_Click(object sender, EventArgs e)
{
}
string getmaxstr(string src, int len = 30)
{
@@ -441,77 +433,25 @@ namespace FEQ0000
newMail.To = string.Join(";", tolist.ToArray());
newMail.CC = string.Join(";", cclist.ToArray());
newMail.BCC = string.Join(";", bcclist.ToArray());
string fn = "";
if (f.chkAttach.Checked)
{
var fi = new System.IO.FileInfo(FCOMMON.Util.CurrentPath + "\\Export\\Purchase_confirm_" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".xls");
var fi = new System.IO.FileInfo(FCOMMON.Util.CurrentPath + "\\Export\\PurchaseNR_confirmeb_" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".xls");
if (fi.Directory.Exists == false) fi.Directory.Create();
fn = fi.FullName;
//FCOMMON.Util.savetoexcel(this.dataGridView1, fi.FullName);
FCOMMON.Util.savetoexcel(this.dataGridView1, fi.FullName);
newMail.Attachments.Add(fi.FullName);
//newMail.Attachments.Add(fi.FullName);
}
if (f.chkList.Checked)
{
var rows = this.rows;
var tabledata = UTIL_EQ0000.MakeDataTableToHTML(rows, fn);
//목록을 본문에 추가한다
System.Text.StringBuilder sb = new StringBuilder();
sb.AppendLine("<table border='1' cellspacing='0' cellpadding='1'>");
sb.AppendLine("<thead>");
foreach (DataGridViewColumn col in this.dataGridView1.Columns)
{
if (col.DataPropertyName.ToLower() == "pumqty") continue;
sb.AppendLine($"<td style='text-align:center;background-color: aqua;'>{col.HeaderText}</td>");
}
sb.AppendLine("</thead>");
sb.AppendLine("<tbody>");
for (int i = 0; i < this.dataGridView1.RowCount; i++)
{
sb.AppendLine("<tr>");
foreach (DataGridViewColumn col in this.dataGridView1.Columns)
{
if (col.DataPropertyName.ToLower() == "pumqty") continue;
var v = dataGridView1.Rows[i].Cells[col.Index].Value;
string value = "";
if (v != null) value = v.ToString();
if (col.ValueType == typeof(int))
{
var ivalue = (int)v;
sb.AppendLine($"<td style='text-align:center'>{ivalue:N0}</td>");
}
else if (col.ValueType == typeof(decimal))
{
var ivalue = (decimal)v;
sb.AppendLine($"<td style='text-align:center'>{ivalue:N0}</td>");
}
else if (col.ValueType == typeof(float))
{
var ivalue = (float)v;
sb.AppendLine($"<td style='text-align:center'>{ivalue:N1}</td>");
}
else if (col.ValueType == typeof(double))
{
var ivalue = (double)v;
sb.AppendLine($"<td style='text-align:center'>{ivalue:N1}</td>");
}
else sb.AppendLine($"<td>{getmaxstr(value)}</td>");
}
sb.AppendLine("</tr>");
}
sb.AppendLine("</tbody>");
sb.AppendLine("</table>");
sb.AppendLine($"항목:{this.bs.Count}건,합계금액:{lbSum.Text}");
form_body = form_body.Replace("{body}", sb.ToString());
}
//newMail.BodyFormat = OlBodyFormat.olFormatHTML;
if (fn.isEmpty() == false)
newMail.Attachments.Add(fn);
form_body = form_body.Replace("{body}", tabledata);
newMail.HTMLBody = form_body + newMail.HTMLBody; //
}
catch (Exception ex)