Ejemplo n.º 1
0
        public void Toprint()
        {
            WriteIntoWord wiw                       = new WriteIntoWord();
            string        FilePath                  = System.Windows.Forms.Application.StartupPath + @"\OverduePaymentReminder.dot"; //模板路径
            string        BookmarkABSdate           = "ABSdate";
            string        FillABSdate               = "2018-03-06";
            string        BookmarkCustomer          = "Customer";
            string        FillCustomer              = "L&V";
            string        BookmarkInvoiceNo         = "InvoiceNo";
            string        FillInvoiceNo             = "IN10001";
            string        BookmarkInvoiceDate       = "InvoiceDate";
            string        FillInvoiceDate           = "2018-02-06";
            string        BookmarkDueDate           = "DueDate";
            string        FillDueDate               = "2018-02-10";
            string        BookmarkOutstandingAmount = "OutstandingAmount";
            string        FillOutstandingAmount     = "500000";
            string        BookmarkEndDate           = "EndDate";
            string        FillEndDate               = "2018-03-10";
            string        BookmarkContactNo         = "ContactNo";
            string        FillContactNo             = "13400000000";
            string        BookmarkSalesname         = "Salesname";
            string        FillSalesname             = "Justin";
            string        SaveDocPath               = System.Windows.Forms.Application.StartupPath + @"\OverduePaymentReminder.doc";

            wiw.OpenDocument(FilePath);
            wiw.WriteIntoDocument(BookmarkABSdate, FillABSdate);
            wiw.WriteIntoDocument(BookmarkCustomer, FillCustomer);
            wiw.WriteIntoDocument(BookmarkInvoiceNo, FillInvoiceNo);
            wiw.WriteIntoDocument(BookmarkInvoiceDate, FillInvoiceDate);
            wiw.WriteIntoDocument(BookmarkDueDate, FillDueDate);
            wiw.WriteIntoDocument(BookmarkOutstandingAmount, FillOutstandingAmount);
            wiw.WriteIntoDocument(BookmarkEndDate, FillEndDate);
            wiw.WriteIntoDocument(BookmarkContactNo, FillContactNo);
            wiw.WriteIntoDocument(BookmarkSalesname, FillSalesname);
            wiw.Save_CloseDocument(SaveDocPath);
            MessageBox.Show("OK");
            this.Dispose();
            this.Close();
        }
Ejemplo n.º 2
0
 public void RedueAutoReminder()
 {
     #region
     string conn = "server = 192.168.19.3; database = AErp_Sinno; uid = Justin; pwd = 5t6y&U*I";
     System.Data.DataTable _dt = new System.Data.DataTable();
     _dt = GetDTbyCust();
     if (_dt != null && _dt.Rows.Count > 0)
     {
         for (int ii = 0; ii < _dt.Rows.Count - 1; ii++)
         {
             WriteIntoWord wiw            = new WriteIntoWord();
             string        FilePath       = System.Windows.Forms.Application.StartupPath + @"\OverduePaymentReminder.dot"; //模板路径
             string        CrdName        = "CrdName";
             string        _CrdName       = _dt.Rows[ii][0].ToString();
             string        CurrID         = "CurrID";
             string        _CurrID        = _dt.Rows[ii][1].ToString();
             string        EmpName        = "EmpName";
             string        _EmpName       = _dt.Rows[ii][2].ToString();
             string        OverOpenTotal  = "OverOpenTotal";
             string        _curr          = _dt.Rows[ii][3].ToString().Substring(0, 3);
             string        _number        = _dt.Rows[ii][3].ToString().Substring(3, _dt.Rows[ii][3].ToString().Length - 3);
             decimal       _Fmoney        = Convert.ToDecimal(_number);
             string        _OverOpenTotal = _curr + string.Format("{0:N}", _Fmoney);
             string        OverOpenTotal1 = "OverOpenTotal1";
             string        NowDate        = "NowDate";
             string        _NowDate       = _dt.Rows[ii][4].ToString();
             string        _NowDate1      = "NowDate1";
             string        DueDate        = "DueDate";
             string        _DueDate       = _dt.Rows[ii][5].ToString();
             string        CNDueDate      = "CNDueDate";
             string        _CNDueDate     = _dt.Rows[ii][6].ToString();
             string        _empid         = _dt.Rows[ii][7].ToString();
             string        Mobile         = "Mobile";
             String        Mobile1        = "Mobile1";
             string        _Mobile        = _dt.Rows[ii][8].ToString();
             string        _SMail         = _dt.Rows[ii][9].ToString();
             string        _path          = System.Windows.Forms.Application.StartupPath + @"\Export\" + DateTime.Now.ToString("yyyyMMdd") + @"\";
             if (!Directory.Exists(_path))
             {
                 Directory.CreateDirectory(_path);
             }
             string SaveDocPath = _path + _CrdName + _CurrID + "_OverduePaymentReminder.pdf";
             wiw.OpenDocument(FilePath);
             //wiw.WriteIntoDocument(CrdName, _CrdName);
             // wiw.WriteIntoDocument(CurrID, _CurrID);
             wiw.WriteIntoDocument(EmpName, _EmpName);
             wiw.WriteIntoDocument(OverOpenTotal, _OverOpenTotal);
             wiw.WriteIntoDocument(OverOpenTotal1, _OverOpenTotal);
             wiw.WriteIntoDocument(NowDate, _NowDate);
             wiw.WriteIntoDocument(_NowDate1, _NowDate);
             wiw.WriteIntoDocument(DueDate, _DueDate);
             wiw.WriteIntoDocument(CNDueDate, _CNDueDate);
             wiw.WriteIntoDocument(Mobile, _Mobile);
             wiw.WriteIntoDocument(Mobile1, _Mobile);
             System.Data.DataTable _dts = new System.Data.DataTable();
             _dts = Utils.executeQueryT("Pro_GetOpenSAInvList '" + _CrdName + "','" + _CurrID + "','" + _empid + "'", conn);
             if (_dts != null && _dts.Rows.Count > 0)
             {
                 wiw.WriteIntoTable("Report__", _dts);
             }
             wiw.Save_CloseDocument(SaveDocPath);
             Utils.sendMail("Finance", _SMail, "", SaveDocPath, _EmpName, _CrdName, _OverOpenTotal);
         }
     }
     #endregion
 }
Ejemplo n.º 3
0
        public void Toprint(string strFileName, string pid, int index)
        {
            WriteIntoWord wiw      = new WriteIntoWord();
            string        FilePath = Server.MapPath("template\\" + strFileName + ".dot");//模板路径

            string            FillProjectName = Lbproname.Text.Trim();
            string            FillPlanMoney   = Lbplan.Text.Trim();
            double            RMB             = Convert.ToDouble(FillPlanMoney);
            RMBCapitalization numClass        = new RMBCapitalization();
            string            FillRMB         = numClass.RMBAmount(RMB);

            string FillName             = "";
            string FillSex              = "";
            string FillAge              = "";
            string FillRecipientsADD    = "";
            string FillWorkplace        = "";
            string FillIncomlowID       = "";
            string FillRecipientsADDnow = "";
            string FillTelphoneADD      = "";
            string FillArrIncome        = "";
            string FillCanjiID          = "";
            string FillOfficerID        = "";
            string FillRequest          = "";
            string FillComefrom         = "";
            string FillPersons          = "";
            string FillGuanming         = "";

            #region "家庭成员"
            string FillFamName1      = "";
            string FillFamRelation1  = "";
            string FillFamWorkplace1 = "";
            string FillFamWork1      = "";
            string FillFamIncome1    = "";

            string FillFamName2      = "";
            string FillFamRelation2  = "";
            string FillFamWorkplace2 = "";
            string FillFamWork2      = "";
            string FillFamIncome2    = "";

            string FillFamName3      = "";
            string FillFamRelation3  = "";
            string FillFamWorkplace3 = "";
            string FillFamWork3      = "";
            string FillFamIncome3    = "";

            string FillFamName4      = "";
            string FillFamRelation4  = "";
            string FillFamWorkplace4 = "";
            string FillFamWork4      = "";
            string FillFamIncome4    = "";
            #endregion

            double sumIncome       = 0;
            double incomePerPerson = 0;

            string SaveDocPath = "";
            string SavePdfPath = "";

            if (pid != "")
            {
                string          strselect   = string.Format("select *,date_format(from_days(to_days(now())-to_days(SUBSTRING(recipientsPIdcard,7,8))),'%Y')+0 as newAge from e_recipients where recipientsPIdcard='{0}'", pid);
                MySqlDataReader mysqlreader = msq.getmysqlread(strselect);
                while (mysqlreader.Read())
                {
                    FillName             = mysqlreader.GetString("recipientsName");
                    FillSex              = mysqlreader.GetString("sex");
                    FillAge              = mysqlreader.GetString("newAge");
                    FillRecipientsADD    = mysqlreader.GetString("recipientsADD");
                    FillWorkplace        = mysqlreader.GetString("workplace");
                    FillIncomlowID       = mysqlreader.GetString("incomlowID");
                    FillRecipientsADDnow = mysqlreader.GetString("recipientsADDnow");
                    FillTelphoneADD      = mysqlreader.GetString("telphoneADD");
                    FillArrIncome        = mysqlreader.GetString("arrIncome");
                    FillCanjiID          = mysqlreader.GetString("canID");
                    FillOfficerID        = mysqlreader.GetString("officerID");
                    #region "家庭成员"
                    FillFamName1      = mysqlreader.GetString("famName1");
                    FillFamRelation1  = mysqlreader.GetString("famRelation1");
                    FillFamWorkplace1 = mysqlreader.GetString("famWorkplace1");
                    FillFamWork1      = mysqlreader.GetString("famWork1");
                    FillFamIncome1    = mysqlreader.GetString("famIncome1");

                    FillFamName2      = mysqlreader.GetString("famName2");
                    FillFamRelation2  = mysqlreader.GetString("famRelation2");
                    FillFamWorkplace2 = mysqlreader.GetString("famWorkplace2");
                    FillFamWork2      = mysqlreader.GetString("famWork2");
                    FillFamIncome2    = mysqlreader.GetString("famIncome2");

                    FillFamName3      = mysqlreader.GetString("famName3");
                    FillFamRelation3  = mysqlreader.GetString("famRelation3");
                    FillFamWorkplace3 = mysqlreader.GetString("famWorkplace3");
                    FillFamWork3      = mysqlreader.GetString("famWork3");
                    FillFamIncome3    = mysqlreader.GetString("famIncome3");

                    FillFamName4      = mysqlreader.GetString("famName4");
                    FillFamRelation4  = mysqlreader.GetString("famRelation4");
                    FillFamWorkplace4 = mysqlreader.GetString("famWorkplace4");
                    FillFamWork4      = mysqlreader.GetString("famWork4");
                    FillFamIncome4    = mysqlreader.GetString("famIncome4");
                    #endregion
                }
                string selectRequest = string.Format("select request from e_pr where recipientID=(select recipientsID from e_recipients where recipientsPIdcard='{0}')", pid);
                mysqlreader = msq.getmysqlread(selectRequest);
                while (mysqlreader.Read())
                {
                    FillRequest = mysqlreader.GetString("request");
                }


                int numPerson = 1;
                if ((FillArrIncome != "") && (FillArrIncome != "0"))
                {
                    sumIncome += Convert.ToDouble(FillArrIncome);
                }
                if (FillFamIncome1 != "")
                {
                    numPerson++;
                    if (FillFamIncome1 != "0")
                    {
                        sumIncome += Convert.ToDouble(FillFamIncome1);
                    }
                }
                if (FillFamIncome2 != "")
                {
                    numPerson++;
                    if (FillFamIncome2 != "0")
                    {
                        sumIncome += Convert.ToDouble(FillFamIncome2);
                    }
                }
                if (FillFamIncome3 != "")
                {
                    numPerson++;
                    if (FillFamIncome3 != "0")
                    {
                        sumIncome += Convert.ToDouble(FillFamIncome3);
                    }
                }
                if (FillFamIncome4 != "")
                {
                    numPerson++;
                    if (FillFamIncome4 != "0")
                    {
                        sumIncome += Convert.ToDouble(FillFamIncome4);
                    }
                }
                incomePerPerson = Math.Round((sumIncome / numPerson), 2);
                SaveDocPath     = Server.MapPath("template\\" + strFileName + index.ToString() + ".doc");
                SavePdfPath     = Server.MapPath("template\\" + strFileName + index.ToString() + ".pdf");
            }
            else
            {
                SaveDocPath = Server.MapPath("template\\" + strFileName + ".doc");
                SavePdfPath = Server.MapPath("template\\" + strFileName + ".pdf");
            }



            wiw.OpenDocument(FilePath);
            if (strFileName == "附1北京市朝阳区慈善协会救助项目申请表")
            {
                wiw.WriteIntoDocument("leibieMark", lblLeibie.Text.ToString());
                wiw.WriteIntoDocument("projectNameMark", FillProjectName);
                wiw.WriteIntoDocument("planMoneyMark", FillPlanMoney);
                wiw.WriteIntoDocument("pidMark", pid);
                wiw.WriteIntoDocument("nameMark", FillName);
                wiw.WriteIntoDocument("sexMark", FillSex);
                wiw.WriteIntoDocument("ageMark", FillAge);
                wiw.WriteIntoDocument("recipientsADDMark", FillRecipientsADD);
                wiw.WriteIntoDocument("workplaceMark", FillWorkplace);
                wiw.WriteIntoDocument("incomlowIDMark", FillIncomlowID);
                wiw.WriteIntoDocument("recipientsADDnowMark", FillRecipientsADDnow);
                wiw.WriteIntoDocument("telphoneADDMark", FillTelphoneADD);
                wiw.WriteIntoDocument("arrIncomeMark", FillArrIncome);
                wiw.WriteIntoDocument("RMBMark", FillRMB);
                wiw.WriteIntoDocument("generalIncomeMark", sumIncome.ToString());
                wiw.WriteIntoDocument("incomePerPersonMark", incomePerPerson.ToString());
                wiw.WriteIntoDocument("canjiIDMark", FillCanjiID);
                wiw.WriteIntoDocument("officerIDMark", FillOfficerID);
                wiw.WriteIntoDocument("requestMark", FillRequest);

                #region "家庭成员"
                wiw.WriteIntoDocument("famName1Mark", FillFamName1);
                wiw.WriteIntoDocument("famRelation1Mark", FillFamRelation1);
                wiw.WriteIntoDocument("famWorkplace1Mark", FillFamWorkplace1);
                wiw.WriteIntoDocument("famWork1Mark", FillFamWork1);
                wiw.WriteIntoDocument("famIncome1Mark", FillFamIncome1);

                wiw.WriteIntoDocument("famName2Mark", FillFamName2);
                wiw.WriteIntoDocument("famRelation2Mark", FillFamRelation2);
                wiw.WriteIntoDocument("famWorkplace2Mark", FillFamWorkplace2);
                wiw.WriteIntoDocument("famWork2Mark", FillFamWork2);
                wiw.WriteIntoDocument("famIncome2Mark", FillFamIncome2);

                wiw.WriteIntoDocument("famName3Mark", FillFamName3);
                wiw.WriteIntoDocument("famRelation3Mark", FillFamRelation3);
                wiw.WriteIntoDocument("famWorkplace3Mark", FillFamWorkplace3);
                wiw.WriteIntoDocument("famWork3Mark", FillFamWork3);
                wiw.WriteIntoDocument("famIncome3Mark", FillFamIncome3);

                wiw.WriteIntoDocument("famName4Mark", FillFamName4);
                wiw.WriteIntoDocument("famRelation4Mark", FillFamRelation4);
                wiw.WriteIntoDocument("famWorkplace4Mark", FillFamWorkplace4);
                wiw.WriteIntoDocument("famWork4Mark", FillFamWork4);
                wiw.WriteIntoDocument("famIncome4Mark", FillFamIncome4);
                #endregion
            }
            if (strFileName == "附2冠名慈善捐助金使用项目书")
            {
                wiw.WriteIntoDocument("projectNameMark", FillProjectName);
                wiw.WriteIntoDocument("planMoneyMark", FillPlanMoney);
                wiw.WriteIntoDocument("RMBMark", FillRMB);
                wiw.WriteIntoDocument("conditionMark", Lbrestnow.Text.ToString());
                wiw.WriteIntoDocument("descMark", projectDir.Text.ToString());
                for (int i = 0; i < dgData.Items.Count; i++)
                {
                    FillPersons = FillPersons + ((Label)(dgData.Items[i].FindControl("labID"))).Text.ToString() + ";";
                }
                wiw.WriteIntoDocument("personsMark", FillPersons);
                wiw.WriteIntoDocument("numMark", dgData.Items.Count.ToString());
                for (int i = 0; i < dgData0.Items.Count; i++)
                {
                    FillGuanming = FillGuanming + ((Label)(dgData0.Items[i].FindControl("labname"))).Text.ToString() + ";";
                }
                wiw.WriteIntoDocument("guanmingMark", FillGuanming);
            }
            if (strFileName == "附3北京市朝阳区慈善协会救助项目书")
            {
                wiw.WriteIntoDocument("projectNameMark", FillProjectName);
                wiw.WriteIntoDocument("leibieMark", lblLeibie.Text.ToString());
                wiw.WriteIntoDocument("planMoneyMark", FillPlanMoney);
                wiw.WriteIntoDocument("RMBMark", FillRMB);
                wiw.WriteIntoDocument("descMark", projectDir.Text.ToString());
                for (int i = 0; i < dgData0.Items.Count; i++)
                {
                    FillComefrom = FillComefrom + (i + 1).ToString() + "、" + ((Label)(dgData0.Items[i].FindControl("labname"))).Text.ToString() + ":¥" + ((Label)(dgData0.Items[i].FindControl("labguanming"))).Text.ToString() + ";";
                }

                wiw.WriteIntoDocument("comefromMark", FillComefrom);
            }

            wiw.Save_CloseDocument(SaveDocPath);
            WordToPdf(SaveDocPath, SavePdfPath);
            if (pid == "")
            {
                DownLoadFile("template\\" + strFileName + ".pdf");
            }
        }