Диплом: Автоматизация документооборота материально-технического оборудования в ООО "Транском"

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам
111
if (cbFrom.Items.Count > 0 && cbFrom.SelectedIndex >= 0)
try
{
sb = new StringBuilder();
xml = new StringBuilder();
fname = string.Format("{0}{1}", Application.StartupPath +
"\\RPT\\", FI[cbFrom.SelectedIndex].Name);
using (StreamReader sr = new StreamReader(fname,
Encoding.GetEncoding(1251)))
{
xml.Append(sr.ReadToEnd());
}
s = xml.ToString();
DTL = null; // -- нет поштучного раздела --
HN = s.IndexOf("[BeginDetail]");
if (HN >= 0)
{
HK = s.IndexOf("[EndDetail]");
if (HK >= 0)
{
HN = HN + 13;
DTL = s.Substring(HN, HK - HN);
xml.Remove(HN, HK - HN);
}
}
NV = NameValue.GetNewDTLNV(xml.ToString()); // Список
замін головної частини звіту
NameValue.SetValue(ref NV, "[DDoc]", string.Format("<Data
ss:Type=\"DateTime\">{0}</Data>", DTR.Value.Value.ToString("yyyy-MM-dd")));
NameValue.SetValue(ref NV, "[NDoc]", string.Format("{0}",
EName.Text));
NameValue.SetValue(ref NV, "[ChoSpisano]",
string.Format("{0}", EChoSpis.Text));
NameValue.SetValue(ref NV, "[ChoName]", string.Format("{0}",
EChoName.Text));
NameValue.SetValue(ref NV, "[ChoKod]", string.Format("{0}",
EChoKod.Text));
RC = dsA.Tables["skl_MH"].Rows.Find(Id_Fr);
if (RC != null)
{
NameValue.SetValue(ref NV, "[FrName]",
RC["MHName"].ToString());
NameValue.SetValue(ref NV, "[FrKod]",
RC["MHKod"].ToString());
}
112
RC = dsA.Tables["skl_MH"].Rows.Find(Id_MH);
if (RC != null)
{
NameValue.SetValue(ref NV, "[MHName]",
RC["MHName"].ToString());
NameValue.SetValue(ref NV, "[MHKod]",
RC["MHKod"].ToString());
}
RC = dsA.Tables["skl_US"].Rows.Find(Id_Sdal);
if (RC != null)
{
NameValue.SetValue(ref NV, "[SdalName]",
RC["USName"].ToString());
NameValue.SetValue(ref NV, "[SdalMOL]",
RC["KodMOL"].ToString());
NameValue.SetValue(ref NV, "[SdalTN]",
RC["TabNom"].ToString());
NameValue.SetValue(ref NV, "[SdalDolg]",
RC["Dolg"].ToString());
}
RC = dsA.Tables["skl_US"].Rows.Find(Id_Prin);
if (RC != null)
{
NameValue.SetValue(ref NV, "[PrinName]",
RC["USName"].ToString());
NameValue.SetValue(ref NV, "[PrinMOL]",
RC["KodMOL"].ToString());
NameValue.SetValue(ref NV, "[PrinTN]",
RC["TabNom"].ToString());
NameValue.SetValue(ref NV, "[PrinDolg]",
RC["Dolg"].ToString());
}
if (string.IsNullOrEmpty(DTL)) // --- без Detail ---
{
Npp = 1;
RC = dsOS.Tables["skl_OS"].Rows[0];
NameValue.SetValue(ref NV, "[Npp]", string.Format("<Data
ss:Type=\"Number\">{0}</Data>", Npp));
NameValue.SetValue(ref NV, "[OSName]", RC["OSName"]);
NameValue.SetValue(ref NV, "[Coment]", RC["Coment"]);
NameValue.SetValue(ref NV, "[INom]", RC["INom"]);
zz = RC["NNom"].ToString().Trim();
NameValue.SetValue(ref NV, "[NNom]", zz);
if (zz.Length > 3) NameValue.SetValue(ref NV, "[NNomGr]",
RC["NNom"].ToString().Substring(1, 4));
if (zz.Length > 5) NameValue.SetValue(ref NV, "[NNomPg]",
RC["NNom"].ToString().Substring(5, 2));
113
if (zz.Length > 7) NameValue.SetValue(ref NV, "[NNomMk]",
RC["NNom"].ToString().Substring(7));
NameValue.SetValue(ref NV, "[ZNom]", RC["ZNom"]);
NameValue.SetValue(ref NV, "[InDat]", string.Format("<Data
ss:Type=\"DateTime\">{0}</Data>",
IPY_Util.Int2Dat((int)RC["ZDat"]).ToString("yyyy-MM-dd")));
NameValue.SetValue(ref NV, "[ZDat]", string.Format("<Data
ss:Type=\"DateTime\">{0}</Data>",
IPY_Util.Int2Dat((int)RC["ZDat"]).ToString("yyyy-MM-dd")));
NameValue.SetValue(ref NV, "[Cnt]", string.Format("<Data
ss:Type=\"Number\">{0}</Data>", (int)RC["Cnt"]));
NameValue.SetValue(ref NV, "[Stoim]", string.Format("<Data
ss:Type=\"Number\">{0}</Data>", ((decimal)RC["Stoim"]).ToString("0.00",
Program.CIDot)));
NameValue.SetValue(ref NV, "[Suma]", string.Format("<Data
ss:Type=\"Number\">{0}</Data>", ((decimal)RC["Stoim"] *
(int)RC["Cnt"]).ToString("0.00", Program.CIDot)));
for (int x = 0; x < dsOS.Tables["skl_OSMet"].Rows.Count; x++)
{
RX = dsOS.Tables["skl_OSMet"].Rows[x];
m = 0;
if (!RX.IsNull("Masa")) m = (decimal)RX["Masa"];
NameValue.SetValue(ref NV
, string.Format("[Masa{0}]", RX["Id_DM"].ToString())
, string.Format("<Data ss:Type=\"Number\">{0}</Data>",
m.ToString("0.######", Program.CIDot)));
}
}
else // --- Detail ---
{
T = new xTables.tOSMet_01();
dtl = new StringBuilder();
for (int n = 0; n < dsOS.Tables["skl_OS"].Rows.Count; n++)
{
RC = dsOS.Tables["skl_OS"].Rows[n];
ND = NameValue.GetNewDTLNV(DTL); // Список замін
табличної частини звіту
NameValue.SetValue(ref ND, "[Npp]", string.Format("<Data
ss:Type=\"Number\">{0}</Data>", n+1));
NameValue.SetValue(ref ND, "[OSName]", RC["OSName"]);
NameValue.SetValue(ref ND, "[Coment]", RC["Coment"]);
NameValue.SetValue(ref ND, "[INom]", RC["INom"]);
zz = RC["NNom"].ToString().Trim();
NameValue.SetValue(ref ND, "[NNom]", zz);
if (zz.Length > 3) NameValue.SetValue(ref ND, "[NNomGr]",
RC["NNom"].ToString().Substring(1, 4));
114
if (zz.Length > 5) NameValue.SetValue(ref ND, "[NNomPg]",
RC["NNom"].ToString().Substring(5, 2));
if (zz.Length > 7) NameValue.SetValue(ref ND,
"[NNomMk]", RC["NNom"].ToString().Substring(7));
NameValue.SetValue(ref ND, "[ZNom]", RC["ZNom"]);
NameValue.SetValue(ref ND, "[InDat]",
string.Format("<Data ss:Type=\"DateTime\">{0}</Data>",
IPY_Util.Int2Dat((int)RC["ZDat"]).ToString("yyyy-MM-dd")));
NameValue.SetValue(ref ND, "[ZDat]", string.Format("<Data
ss:Type=\"DateTime\">{0}</Data>",
IPY_Util.Int2Dat((int)RC["ZDat"]).ToString("yyyy-MM-dd")));
NameValue.SetValue(ref ND, "[Cnt]", string.Format("<Data
ss:Type=\"Number\">{0}</Data>", (int)RC["Cnt"]));
NameValue.SetValue(ref ND, "[Stoim]",
string.Format("<Data ss:Type=\"Number\">{0}</Data>",
((decimal)RC["Stoim"]).ToString("0.00", Program.CIDot)));
NameValue.SetValue(ref ND, "[Suma]",
string.Format("<Data ss:Type=\"Number\">{0}</Data>", ((decimal)RC["Stoim"] *
(int)RC["Cnt"]).ToString("0.00", Program.CIDot)));
NameValue.SetValue(ref ND, "[ChoName]",
string.Format("{0}", EChoName.Text));
NameValue.SetValue(ref ND, "[ChoKod]",
string.Format("{0}", EChoKod.Text));
dsOS.taOM.FillByStrFLTR(T
, string.Format("Id_OS={0}",RC["Id_OS"])
, "Id_DM");
for (int x = 0; x < T.Rows.Count; x++)
{
RX = T.Rows[x];
m = 0;
if (!RX.IsNull("Masa")) m = (decimal)RX["Masa"];
NameValue.SetValue(ref ND
, string.Format("[Masa{0}]", RX["Id_DM"].ToString())
, string.Format("<Data
ss:Type=\"Number\">{0}</Data>", m.ToString("0.######", Program.CIDot)));
}
s = DTL;
IPY_Util.RTFParseS(ref s, false, ND);
IPY_Util.RTFParseS(ref s, true, NV);
dtl.AppendLine(s);
}
if (dtl.Length == 0)
{
s = DTL;
IPY_Util.RTFParseS(ref s, true, NV);
dtl.AppendLine(DTL);
}
115
s = xml.ToString().Replace("[BeginDetail]", dtl.ToString());
}
IPY_Util.RTFParseS(ref s, true, NV);
xml.Length = 0;
xml.Append(s);
fname = string.Format("{0}{1}", Application.StartupPath +
"\\OUT\\", FI[cbFrom.SelectedIndex].Name);
StreamWriter F = new StreamWriter(fname, false,
Encoding.GetEncoding("windows-1251"));
F.Write(xml.ToString());
F.Close();
IPY_Util.YNBox(string.Format(Properties.Resources.ResourceManager.GetString("E
x_FileSaved"), fname));
System.Diagnostics.Process.Start(fname);
}
catch (Exception ex)
{
IPY_Util.YNBox(string.Format(" {0}: {1}",
Properties.Resources.ResourceManager.GetString("pb_Error"), ex.Message));
}
}
}
}
namespace Sklad
{
partial class eAktPU
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be
disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
116
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle
dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
this.cbTypA = new System.Windows.Forms.ComboBox();
this.lbTypA = new System.Windows.Forms.Label();
this.lbName = new System.Windows.Forms.Label();
this.EName = new System.Windows.Forms.TextBox();
this.ESdal = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.EPrin = new System.Windows.Forms.TextBox();
this.lbPrin = new System.Windows.Forms.Label();
this.EComent = new System.Windows.Forms.TextBox();
this.lbPsw = new System.Windows.Forms.Label();
this.EId = new System.Windows.Forms.TextBox();
this.lbId = new System.Windows.Forms.Label();
this.EFr = new System.Windows.Forms.TextBox();
this.lbTN = new System.Windows.Forms.Label();
this.EMH = new System.Windows.Forms.TextBox();
this.lbKM = new System.Windows.Forms.Label();
this.cbTypOS = new System.Windows.Forms.ComboBox();
this.DTR = new Sklad.NullableDateTimePicker();
this.label2 = new System.Windows.Forms.Label();
this.btSdal = new System.Windows.Forms.Button();
this.btPrin = new System.Windows.Forms.Button();
this.cbTypSg = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
this.gbOS = new System.Windows.Forms.GroupBox();
this.zGridPnl = new Sklad.zGridPanel();
this.DGV = new System.Windows.Forms.DataGridView();
this.xId_OS = new
System.Windows.Forms.DataGridViewTextBoxColumn();
this.xTypOS = new
System.Windows.Forms.DataGridViewTextBoxColumn();
this.xOSName = new
System.Windows.Forms.DataGridViewTextBoxColumn();
this.xCnt = new
System.Windows.Forms.DataGridViewTextBoxColumn();
this.xStoim = new
System.Windows.Forms.DataGridViewTextBoxColumn();
this.xNNom = new
System.Windows.Forms.DataGridViewTextBoxColumn();
117
this.xINom = new
System.Windows.Forms.DataGridViewTextBoxColumn();
this.xZDat = new Sklad.IPY_IDatColumn();
this.xPsw = new
System.Windows.Forms.DataGridViewTextBoxColumn();
this.xZNom = new
System.Windows.Forms.DataGridViewTextBoxColumn();
this.panel1 = new System.Windows.Forms.Panel();
this.cbFrom = new System.Windows.Forms.ComboBox();
this.btRPT = new System.Windows.Forms.Button();
this.gbDM = new System.Windows.Forms.GroupBox();
this.DGVM = new System.Windows.Forms.DataGridView();
this.xId_DM = new
System.Windows.Forms.DataGridViewTextBoxColumn();
this.xDMName = new
System.Windows.Forms.DataGridViewTextBoxColumn();
this.xMasa = new
System.Windows.Forms.DataGridViewTextBoxColumn();
this.OSComent = new System.Windows.Forms.TextBox();
this.lbComent = new System.Windows.Forms.Label();
this.EdPanel.SuspendLayout();
this.BtPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.EP)).BeginInit();
this.gbOS.SuspendLayout();
this.zGridPnl.ContentPanel.SuspendLayout();
this.zGridPnl.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.DGV)).BeginInit();
this.panel1.SuspendLayout();
this.gbDM.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.DGVM)).BeginInit();
this.SuspendLayout();
//
// EdPanel
//
this.EdPanel.Controls.Add(this.label3);
this.EdPanel.Controls.Add(this.cbTypSg);
this.EdPanel.Controls.Add(this.btPrin);
this.EdPanel.Controls.Add(this.btSdal);
this.EdPanel.Controls.Add(this.label2);
this.EdPanel.Controls.Add(this.DTR);
this.EdPanel.Controls.Add(this.cbTypOS);
this.EdPanel.Controls.Add(this.EMH);
this.EdPanel.Controls.Add(this.lbKM);
this.EdPanel.Controls.Add(this.EFr);
this.EdPanel.Controls.Add(this.lbTN);
this.EdPanel.Controls.Add(this.EId);
this.EdPanel.Controls.Add(this.lbId);
118
this.EdPanel.Controls.Add(this.EComent);
this.EdPanel.Controls.Add(this.lbPsw);
this.EdPanel.Controls.Add(this.EPrin);
this.EdPanel.Controls.Add(this.lbPrin);
this.EdPanel.Controls.Add(this.ESdal);
this.EdPanel.Controls.Add(this.label1);
this.EdPanel.Controls.Add(this.EName);
this.EdPanel.Controls.Add(this.lbName);
this.EdPanel.Controls.Add(this.lbTypA);
this.EdPanel.Controls.Add(this.cbTypA);
this.EdPanel.Dock = System.Windows.Forms.DockStyle.Top;
this.EdPanel.Size = new System.Drawing.Size(761, 140);
//
// BtPanel
//
this.BtPanel.Location = new System.Drawing.Point(0, 537);
this.BtPanel.Size = new System.Drawing.Size(761, 38);
//
// btSave
//
this.btSave.Location = new System.Drawing.Point(664, 6);
//
// cbTypA
//
this.cbTypA.DropDownStyle =
System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbTypA.Enabled = false;
this.cbTypA.FormattingEnabled = true;
this.cbTypA.Location = new System.Drawing.Point(114, 36);
this.cbTypA.Margin = new System.Windows.Forms.Padding(2);
this.cbTypA.Name = "cbTypA";
this.cbTypA.Size = new System.Drawing.Size(240, 21);
this.cbTypA.TabIndex = 0;
this.cbTypA.SelectedIndexChanged += new
System.EventHandler(this.EName_TextChanged);
this.cbTypA.KeyPress += new
System.Windows.Forms.KeyPressEventHandler(this.EName_KeyPress);
//
// lbTypA
//
this.lbTypA.Location = new System.Drawing.Point(18, 36);
this.lbTypA.Margin = new System.Windows.Forms.Padding(2);
this.lbTypA.Name = "lbTypA";
this.lbTypA.Size = new System.Drawing.Size(92, 21);
this.lbTypA.TabIndex = 1;
this.lbTypA.Text = "Тип акта";
this.lbTypA.TextAlign =
System.Drawing.ContentAlignment.MiddleRight;
119
//
// lbName
//
this.lbName.Location = new System.Drawing.Point(377, 35);
this.lbName.Margin = new System.Windows.Forms.Padding(2);
this.lbName.Name = "lbName";
this.lbName.Size = new System.Drawing.Size(78, 21);
this.lbName.TabIndex = 2;
this.lbName.Text = "№ Документа";
this.lbName.TextAlign =
System.Drawing.ContentAlignment.MiddleRight;
//
// EName
//
this.EName.Location = new System.Drawing.Point(459, 36);
this.EName.Margin = new System.Windows.Forms.Padding(2);
this.EName.MaxLength = 20;
this.EName.Name = "EName";
this.EName.Size = new System.Drawing.Size(80, 20);
this.EName.TabIndex = 1;
this.EName.TextChanged += new
System.EventHandler(this.EName_TextChanged);
this.EName.KeyPress += new
System.Windows.Forms.KeyPressEventHandler(this.EName_KeyPress);
//
// ESdal
//
this.ESdal.Location = new System.Drawing.Point(114, 62);
this.ESdal.Margin = new System.Windows.Forms.Padding(2);
this.ESdal.MaxLength = 100;
this.ESdal.Name = "ESdal";
this.ESdal.ReadOnly = true;
this.ESdal.Size = new System.Drawing.Size(212, 20);
this.ESdal.TabIndex = 2;
this.ESdal.TextChanged += new
System.EventHandler(this.EName_TextChanged);
this.ESdal.KeyPress += new
System.Windows.Forms.KeyPressEventHandler(this.EName_KeyPress);
//
// label1
//
this.label1.Location = new System.Drawing.Point(13, 62);
this.label1.Margin = new System.Windows.Forms.Padding(2);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(97, 21);
this.label1.TabIndex = 4;
this.label1.Text = "Сдал";
120
this.label1.TextAlign =
System.Drawing.ContentAlignment.MiddleRight;
//
// EPrin
//
this.EPrin.Location = new System.Drawing.Point(459, 62);
this.EPrin.Margin = new System.Windows.Forms.Padding(2);
this.EPrin.MaxLength = 10;
this.EPrin.Name = "EPrin";
this.EPrin.ReadOnly = true;
this.EPrin.Size = new System.Drawing.Size(212, 20);
this.EPrin.TabIndex = 8;
this.EPrin.TextChanged += new
System.EventHandler(this.EName_TextChanged);
this.EPrin.KeyPress += new
System.Windows.Forms.KeyPressEventHandler(this.EName_KeyPress);
//
// lbPrin
//
this.lbPrin.Location = new System.Drawing.Point(358, 62);
this.lbPrin.Margin = new System.Windows.Forms.Padding(2);
this.lbPrin.Name = "lbPrin";
this.lbPrin.Size = new System.Drawing.Size(97, 21);
this.lbPrin.TabIndex = 6;
this.lbPrin.Text = "Принял";
this.lbPrin.TextAlign =
System.Drawing.ContentAlignment.MiddleRight;
//
// EComent
//
this.EComent.Location = new System.Drawing.Point(114, 110);
this.EComent.Margin = new System.Windows.Forms.Padding(2);
this.EComent.MaxLength = 255;
this.EComent.Name = "EComent";
this.EComent.Size = new System.Drawing.Size(585, 20);
this.EComent.TabIndex = 9;
this.EComent.TextChanged += new
System.EventHandler(this.EName_TextChanged);
this.EComent.KeyPress += new
System.Windows.Forms.KeyPressEventHandler(this.EName_KeyPress);
//
// lbPsw
//
this.lbPsw.Location = new System.Drawing.Point(19, 109);
this.lbPsw.Margin = new System.Windows.Forms.Padding(2);
this.lbPsw.Name = "lbPsw";
this.lbPsw.Size = new System.Drawing.Size(91, 21);
this.lbPsw.TabIndex = 8;

Смотрите также:

"Автоматизация обработки заявок ООО "Проектно-Строительная Компания"
"Автоматизация процесса аттестации персонала для ООО "Нэт Бай Нэт Холдинг"
"Анализ интернет-активности конкурентов ( на примере конкурентов "Газпром нефть")
"Бухгалтерский учёт и аудит расчётов с подотчётними лицами в организации на примере ООО "ЛОЦ 10""
«Психологическое сопровождение персонала в организации на примере ООО «Крокус»
Cовершенствование деловой оценки персонала в организации (на примере ООО "Даймонд кейтеринг развитие")
IPO - инструмент финансирования деятельности организации. На примере ПАО «Нефтяная компания «Лукойл»
PR как средство продвижения организации (на примере ПАО "Тамбовский завод "Комсомолец им. Н.С. Артемова")
PR-коммуникации в сфере общественного питания (на примере кафе-кондитерской «Cream Cheese»)
SMM как средство повышения эффективности работы учреждений социокультурной сферы (на примере Малого театра)