Example #1
0
        private void btSubmit_Click(object sender, EventArgs e)
        {
            if (tbInsuranceNo.Text.Trim().Length != 7)
            {
                MessageBox.Show("左上角保单号有误,应为七位数字");
                return;
            }
            try
            {
                long.Parse(tbInsuranceNo.Text.Trim());
            }
            catch
            {
                MessageBox.Show("左上角保单号有误,应为七位数字");
                return;
            }
            if (cbName.Text.Trim() == "")
            {
                MessageBox.Show("姓名不能为空");
                return;
            }
            if (tbCardID.Text.Trim() == "")
            {
                MessageBox.Show("证件号码不能为空");
                return;
            }

            this.tbENumber.Text = eNumberHead + EagleAPI.GetRandom62(10000L);//这里不一样
            if (!GlobalVar.b_OffLine)
            {
                if (cbName.Text != GlobalVar.HYXTESTPRINT)
                {
                    HyxStructs hs = new HyxStructs();
                    hs.UserID      = GlobalVar.loginName;
                    hs.eNumber     = tbENumber.Text;
                    hs.IssueNumber = tbInsuranceNo.Text;
                    hs.NameIssued  = cbName.Text;
                    hs.CardType    = "";
                    hs.CardNumber  = tbCardID.Text;
                    hs.Remark      = "009";//4新华出行关爱009
                    hs.IssuePeriod = "10天";
                    hs.IssueBegin  = this.dtpBegin.Value.ToShortDateString() + " 00:00:00";
                    hs.IssueEnd    = this.dtpEnd.Value.ToShortDateString() + " 23:59:59";

                    hs.NameBeneficiary = this.tbBeneficiary.Text;
                    hs.Signature       = this.tbSignature.Text;
                    hs.SignDate        = this.dtpSignDate.Value.ToString();
                    hs.Pnr             = this.tbPnr.Text;
                    if (!hs.SubmitInfo())
                    {
                        MessageBox.Show("数据提交失败!请检查保单号及是否分配或网络是否正常!");
                        return;
                    }
                }
            }
            MessageBox.Show("上传成功");
            this.bt_Print.Enabled = true;
        }
Example #2
0
        private void ptDoc_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            e.Graphics.PageUnit = GraphicsUnit.Millimeter;
            Font ptFontEn = new Font("system", 9, System.Drawing.FontStyle.Regular);
            //Font ptFontCn = new Font("tec", EagleAPI.fontsizecn, System.Drawing.FontStyle.Regular);
            Brush ptBrush = Brushes.Black;

            e.PageSettings.Margins.Left   = 0;
            e.PageSettings.Margins.Right  = 0;
            e.PageSettings.Margins.Top    = 0;
            e.PageSettings.Margins.Bottom = 0;
            PointF o = new PointF();

            o.X = float.Parse(numericUpDown1.Value.ToString());
            o.Y = float.Parse(numericUpDown2.Value.ToString());
            //打印项
            HyxStructs hs    = new HyxStructs();
            float      scale = 1F;

            if (!bLianxu)
            {
                List <string> ptString = new List <string>();
                List <PointF> ptPoint  = new List <PointF>();
                ptString.Add(this.tb保单号码.Text); ptPoint.Add(new PointF(49.3F * scale, 31.4F * scale));
                ptString.Add(this.cb被保险人姓名.Text); ptPoint.Add(new PointF(65.3F * scale, 42.9F * scale));
                ptString.Add(this.tb证件号.Text); ptPoint.Add(new PointF(116.3F * scale, 42.9F * scale));
                ptString.Add(this.tb航班号.Text + "  " + this.tb乘机日.Text); ptPoint.Add(new PointF(111.3F * scale, 57.9F * scale));
                //ptString.Add(this.tb乘机日.Text); ptPoint.Add(new PointF(111.3F * scale, 43.7F * scale));
                ptString.Add(this.tb受益人资料.Text); ptPoint.Add(new PointF(118.9F * scale, 82.0F * scale));
                ptString.Add(this.tb填开日期.Text); ptPoint.Add(new PointF(175.3F * scale, 92.3F * scale));
                ptString.Add(this.tb经办人.Text); ptPoint.Add(new PointF(175.3F * scale, 98.0F * scale));

                /*被保险人姓名:48.5,35.3
                 * 身份证号/护照号:117.9,35.3
                 * 航班号:45.7,43.7
                 * 乘机日:111.3,43.7
                 * 受益人姓名:45.7,59.9
                 * 打印日期:166.6,74.2
                 * 经办人:3.51,83.3*/
                PrintHyx.PrintHyxPublic.PrintItems(ptString.ToArray(), ptPoint.ToArray(), o, ptFontEn, ptBrush, e);
            }
            else
            {
                if (ls == null || ls.Count == 0)
                {
                    return;
                }
                //for (int i = 0; i < ls.Count; i++)
                bool bSubmited = false;
                {
                    hs.UserID           = GlobalVar.loginName;
                    hs.eNumber          = eNumberHead + EagleAPI.GetRandom62(); //this.tb保单号码.Text;
                    hs.IssueNumber      = ls[iPage].Split('~')[2];
                    hs.NameIssued       = ls[iPage].Split('~')[0];
                    hs.CardType         = "航班号" + tb航班号.Text + "乘机日" + tb乘机日.Text;
                    hs.CardNumber       = ls[iPage].Split('~')[1];
                    hs.Remark           = insuranceType;                                    //保险种类别名代码B07
                    hs.IssuePeriod      = "";
                    hs.IssueBegin       = (bhyx ? tb乘机日.Text : dtp保险起始时间.Value.ToString()); //必须为时间串
                    hs.IssueEnd         = (bhyx ? tb乘机日.Text : dtp保险终止时间.Value.ToString()); //必须为时间串
                    hs.SolutionDisputed = "";
                    hs.NameBeneficiary  = tb受益人资料.Text + tb受益人关系.Text;
                    hs.Signature        = tb经办人.Text;  // tbSignatureDate.Text;
                    hs.SignDate         = tb填开日期.Text; //dtp_Date.Value.ToShortDateString();
                    hs.InssuerName      = "";
                    hs.Pnr = tbPnr.Text;
                    if (!hs.SubmitInfo())
                    {
                        MessageBox.Show(ls[iPage].Replace("~", "-") + "提交失败!");
                        bSubmited = false;
                    }
                    else
                    {
                        bSubmited = true;
                    }
                }
                {
                    if (bSubmited)
                    {
                        List <string> ptString = new List <string>();
                        List <PointF> ptPoint  = new List <PointF>();
                        ptString.Add(hs.eNumber); ptPoint.Add(new PointF(49.3F * scale, 31.4F * scale));
                        ptString.Add(this.cb被保险人姓名.Text); ptPoint.Add(new PointF(65.3F * scale, 42.9F * scale));
                        //ptString.Add(this.tb证件号.Text); ptPoint.Add(new PointF(117.9F * scale, 35.5F * scale));
                        //ptString.Add(this.tb航班号.Text); ptPoint.Add(new PointF(45.7F * scale, 43.7F * scale));
                        ptString.Add(ls[iPage].Split('~')[0]); ptPoint.Add(new PointF(116.3F * scale, 42.9F * scale));
                        ptString.Add(ls[iPage].Split('~')[1]); ptPoint.Add(new PointF(111.3F * scale, 57.9F * scale));

                        //ptString.Add(this.tb乘机日.Text); ptPoint.Add(new PointF(111.3F * scale, 43.7F * scale));
                        ptString.Add(this.tb受益人资料.Text); ptPoint.Add(new PointF(118.9F * scale, 82.0F * scale));
                        ptString.Add(this.tb填开日期.Text); ptPoint.Add(new PointF(175.3F * scale, 92.3F * scale));
                        ptString.Add(this.tb经办人.Text); ptPoint.Add(new PointF(175.3F * scale, 98.0F * scale));

                        PrintHyx.PrintHyxPublic.PrintItems(ptString.ToArray(), ptPoint.ToArray(), o, ptFontEn, ptBrush, e);
                    }
                    iPage++;
                    if (iPage < ls.Count)
                    {
                        e.HasMorePages = true;
                    }
                    else
                    {
                        e.HasMorePages = false;
                    }
                }
            }
        }
Example #3
0
        private void ptDoc_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            e.Graphics.PageUnit = GraphicsUnit.Millimeter;
            Font ptFontEn = new Font("system", GlobalVar.fontsize, System.Drawing.FontStyle.Regular);
            //Font ptFontCn = new Font("tec", EagleAPI.fontsizecn, System.Drawing.FontStyle.Regular);
            Brush ptBrush = Brushes.Black;

            e.PageSettings.Margins.Left   = 0;
            e.PageSettings.Margins.Right  = 0;
            e.PageSettings.Margins.Top    = 0;
            e.PageSettings.Margins.Bottom = 0;
            PointF o = new PointF();

            o.X = float.Parse(numericUpDown1.Value.ToString());
            o.Y = float.Parse(numericUpDown2.Value.ToString());
            //打印项
            if (!bLianxu)
            {
                List <string> ptString = new List <string>();
                List <PointF> ptPoint  = new List <PointF>();
                ptString.Add(this.tbPolicyIDNo.Text); ptPoint.Add(new PointF(185F, 31F));
                ptString.Add(cbName.Text); ptPoint.Add(new PointF(57.1F, 39F));
                ptString.Add(tbCardID.Text); ptPoint.Add(new PointF(155F, 39F));
                ptString.Add(tbFlightNo.Text); ptPoint.Add(new PointF(57.1F, 50F));
                ptString.Add(tbDate.Text); ptPoint.Add(new PointF(155F, 50F));
                ptString.Add(tbRelation.Text); ptPoint.Add(new PointF(131.8F, 72.4F));
                ptString.Add(tbBenefit.Text); ptPoint.Add(new PointF(47F, 72.4F));
                //ptString.Add(tbPhone.Text); ptPoint.Add(new PointF(44F, 90F));
                ptString.Add(dateTimePicker1.Value.ToShortDateString()); ptPoint.Add(new PointF(106.4F, 84.3F));
                ptString.Add(tbSignatureDate.Text); ptPoint.Add(new PointF(183.1F, 84.3F));
                PrintHyx.PrintHyxPublic.PrintItems(ptString.ToArray(), ptPoint.ToArray(), o, ptFontEn, ptBrush, e);
            }
            else
            {
                if (ls == null || ls.Count == 0)
                {
                    return;
                }
                //for (int i = 0; i < ls.Count; i++)
                bool bSubmited = false;
                {
                    HyxStructs hs = new HyxStructs();
                    hs.UserID           = GlobalVar.loginName;
                    hs.eNumber          = System.DateTime.Now.Year.ToString().Remove(1, 1) + EagleAPI.GetRandom62();// tbPolicyNo.Text;
                    hs.IssueNumber      = ls[iPage].Split('~')[2];
                    hs.NameIssued       = ls[iPage].Split('~')[0];
                    hs.CardType         = "航班号" + tbFlightNo.Text + "乘机日" + tbDate.Text;;
                    hs.CardNumber       = ls[iPage].Split('~')[1];
                    hs.Remark           = "B06";       //9"平安-周游列国"
                    hs.IssuePeriod      = "";
                    hs.IssueBegin       = tbDate.Text; // dtp_Start.Value.ToShortDateString() + " 00:00:00";
                    hs.IssueEnd         = tbDate.Text; // dtp_End.Value.ToShortDateString() + " 00:00:00";
                    hs.SolutionDisputed = "";
                    hs.NameBeneficiary  = tbBenefit.Text;
                    hs.Signature        = this.tbSignatureDate.Text;                      // this.tbSignatureDate.Text;
                    hs.SignDate         = this.dateTimePicker1.Value.ToShortDateString(); //dtp_Date.Value.ToShortDateString();
                    hs.InssuerName      = "";
                    hs.Pnr = this.tbPnr.Text;
                    if (!hs.SubmitInfo())
                    {
                        MessageBox.Show(ls[iPage].Replace("~", "-") + "提交失败!");
                        bSubmited = false;
                    }
                    else
                    {
                        bSubmited = true;
                    }
                }
                {
                    if (bSubmited)
                    {
                        List <string> ptString = new List <string>();
                        List <PointF> ptPoint  = new List <PointF>();
                        ptString.Add(this.tbPolicyIDNo.Text); ptPoint.Add(new PointF(185F, 31F));
                        ptString.Add(ls[iPage].Split('~')[0]); ptPoint.Add(new PointF(57.1F, 39F));
                        ptString.Add(ls[iPage].Split('~')[1]); ptPoint.Add(new PointF(155F, 39F));
                        ptString.Add(tbFlightNo.Text); ptPoint.Add(new PointF(57.1F, 50F));
                        ptString.Add(tbDate.Text); ptPoint.Add(new PointF(155F, 50F));
                        ptString.Add(tbRelation.Text); ptPoint.Add(new PointF(131.8F, 72.4F));
                        ptString.Add(tbBenefit.Text); ptPoint.Add(new PointF(47F, 72.4F));
                        //ptString.Add(tbPhone.Text); ptPoint.Add(new PointF(44F, 90F));
                        ptString.Add(dateTimePicker1.Value.ToShortDateString()); ptPoint.Add(new PointF(106.4F, 84.3F));
                        ptString.Add(tbSignatureDate.Text); ptPoint.Add(new PointF(183.1F, 84.3F));
                        PrintHyx.PrintHyxPublic.PrintItems(ptString.ToArray(), ptPoint.ToArray(), o, ptFontEn, ptBrush, e);
                    }
                    iPage++;
                    if (iPage < ls.Count)
                    {
                        e.HasMorePages = true;
                    }
                    else
                    {
                        e.HasMorePages = false;
                    }
                }
            }
        }
Example #4
0
        private void bt_Print_Click(object sender, EventArgs e)
        {
            bLianxu = false;
            save_phone();
            if (tbNo.Text.Trim().Length != 7)
            {
                MessageBox.Show("保单号长度错误,7位");
                return;
            }
            try
            {
                long.Parse(tbNo.Text.Trim());
            }
            catch
            {
                MessageBox.Show("保单号只能为数字");
                return;
            }
            if (cbName.Text.Trim() == "")
            {
                MessageBox.Show("姓名不能为空");
                return;
            }
            if (tbCardID.Text.Trim() == "")
            {
                MessageBox.Show("证件号码不能为空");
                return;
            }
            try
            {
                DateTime.Parse(tbDate.Text.Trim());
            }
            catch
            {
                MessageBox.Show("乘机日期格式错误,如2007-4-2");
                return;
            }
            this.tbPolicyNo.Text = System.DateTime.Now.Year.ToString().Remove(1, 1) + EagleAPI.GetRandom62();
            if (!GlobalVar.b_OffLine)
            {
                if (cbName.Text.Trim() != GlobalVar.HYXTESTPRINT)
                {
                    HyxStructs hs = new HyxStructs();
                    hs.UserID           = GlobalVar.loginName;
                    hs.eNumber          = tbPolicyNo.Text;
                    hs.IssueNumber      = tbNo.Text;
                    hs.NameIssued       = cbName.Text;
                    hs.CardType         = "航班号" + tbFlightNo.Text + "乘机日" + tbDate.Text;;
                    hs.CardNumber       = tbCardID.Text;
                    hs.Remark           = "B06";       //9"平安-周游列国"B06
                    hs.IssuePeriod      = "";
                    hs.IssueBegin       = tbDate.Text; // dtp_Start.Value.ToShortDateString() + " 00:00:00";
                    hs.IssueEnd         = tbDate.Text; // dtp_End.Value.ToShortDateString() + " 00:00:00";
                    hs.SolutionDisputed = "";
                    hs.NameBeneficiary  = tbBenefit.Text;
                    hs.Signature        = this.tbSignatureDate.Text;                      // this.tbSignatureDate.Text;
                    hs.SignDate         = this.dateTimePicker1.Value.ToShortDateString(); //dtp_Date.Value.ToShortDateString();
                    hs.InssuerName      = "";
                    hs.Pnr = this.tbPnr.Text;
                    if (!hs.SubmitInfo())
                    {
                        //MessageBox.Show("数据提交失败!请检查保单号是否已被使用,或网络是否正常!");
                        return;
                    }
                }
            }
            PrintDialog pd = new PrintDialog();

            EagleAPI.PrinterSetupCostom(ptDoc, 951, 399);
            pd.Document = ptDoc;
            //DialogResult dr = pd.ShowDialog();

            //if (dr == DialogResult.OK)
            {
                ptDoc.Print();
            }
        }
Example #5
0
        private void ptDoc_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            e.Graphics.PageUnit = GraphicsUnit.Millimeter;
            Font ptFontEn = new Font("system", 9, System.Drawing.FontStyle.Regular);
            //Font ptFontCn = new Font("tec", EagleAPI.fontsizecn, System.Drawing.FontStyle.Regular);
            Brush ptBrush = Brushes.Black;

            e.PageSettings.Margins.Left   = 0;
            e.PageSettings.Margins.Right  = 0;
            e.PageSettings.Margins.Top    = 0;
            e.PageSettings.Margins.Bottom = 0;
            PointF o = new PointF();

            o.X = float.Parse(numericUpDown1.Value.ToString());
            o.Y = float.Parse(numericUpDown2.Value.ToString());
            //打印项
            HyxStructs hs    = new HyxStructs();
            float      scale = 2360F / 2466F;

            if (!bLianxu)
            {
                List <string> ptString = new List <string>();
                List <PointF> ptPoint  = new List <PointF>();
                ptString.Add(this.cb险种条款.Text); ptPoint.Add(new PointF(59.7F * scale, 20.6F * scale));
                ptString.Add(this.tb保单号码.Text); ptPoint.Add(new PointF(164.9F * scale, 20.6F * scale));
                ptString.Add(this.cb被保险人姓名.Text); ptPoint.Add(new PointF(59.7F * scale, 27.5F * scale));
                ptString.Add(this.cb证件类型.Text + this.tb证件号.Text); ptPoint.Add(new PointF(148.2F * scale, 27.5F * scale));
                ptString.Add(this.tb航班号.Text); ptPoint.Add(new PointF(59.7F * scale, 34.7F * scale));
                ptString.Add(this.tb乘机日.Text); ptPoint.Add(new PointF(131.2F * scale, 34.7F * scale));
                ptString.Add(this.tb保险金额.Text); ptPoint.Add(new PointF(40.7F * scale, 50.4F * scale));
                ptString.Add(this.tb保险费.Text); ptPoint.Add(new PointF(131.2F * scale, 41.5F * scale));
                ptString.Add(this.dtp保险起始时间.Value.ToShortDateString() + " " + tb保险起始时间.Text); ptPoint.Add(new PointF(49.5F * scale, 72.9F * scale));
                ptString.Add(this.dtp保险终止时间.Value.ToShortDateString() + " " + tb保险终止时间.Text); ptPoint.Add(new PointF(120.0F * scale, 72.9F * scale));
                ptString.Add(this.tb受益人关系.Text); ptPoint.Add(new PointF(105.3F * scale, 80.5F * scale));
                ptString.Add(this.tb受益人资料.Text); ptPoint.Add(new PointF(83.3F * scale, 85.7F * scale));
                ptString.Add(this.tb填开单位.Text); ptPoint.Add(new PointF(46.9F * scale, 93.9F * scale));
                ptString.Add(this.tb填开日期.Text); ptPoint.Add(new PointF(126.2F * scale, 93.9F * scale));
                ptString.Add(this.tb经办人.Text); ptPoint.Add(new PointF(187.2F * scale, 93.9F * scale));


                PrintHyx.PrintHyxPublic.PrintItems(ptString.ToArray(), ptPoint.ToArray(), o, ptFontEn, ptBrush, e);
            }
            else
            {
                if (ls == null || ls.Count == 0)
                {
                    return;
                }
                //for (int i = 0; i < ls.Count; i++)
                bool bSubmited = false;
                {
                    hs.UserID           = GlobalVar.loginName;
                    hs.eNumber          = eNumberHead + EagleAPI.GetRandom62(); //this.tb保单号码.Text;
                    hs.IssueNumber      = ls[iPage].Split('~')[2];
                    hs.NameIssued       = ls[iPage].Split('~')[0];
                    hs.CardType         = "航班号" + tb航班号.Text + "乘机日" + tb乘机日.Text;
                    hs.CardNumber       = ls[iPage].Split('~')[1];
                    hs.Remark           = insuranceType;                                    //保险种类别名代码B07
                    hs.IssuePeriod      = "";
                    hs.IssueBegin       = (bhyx ? tb乘机日.Text : dtp保险起始时间.Value.ToString()); //必须为时间串
                    hs.IssueEnd         = (bhyx ? tb乘机日.Text : dtp保险终止时间.Value.ToString()); //必须为时间串
                    hs.SolutionDisputed = "";
                    hs.NameBeneficiary  = tb受益人资料.Text + tb受益人关系.Text;
                    hs.Signature        = tb经办人.Text;  // tbSignatureDate.Text;
                    hs.SignDate         = tb填开日期.Text; //dtp_Date.Value.ToShortDateString();
                    hs.InssuerName      = "";
                    hs.Pnr = tbPnr.Text;
                    if (!hs.SubmitInfo())
                    {
                        MessageBox.Show(ls[iPage].Replace("~", "-") + "提交失败!");
                        bSubmited = false;
                    }
                    else
                    {
                        bSubmited = true;
                    }
                }
                {
                    if (bSubmited)
                    {
                        List <string> ptString = new List <string>();
                        List <PointF> ptPoint  = new List <PointF>();
                        //ptString.Add(this.tb保单序号.Text); ptPoint.Add(new PointF(185F, 31F));
                        //ptString.Add(ls[iPage].Split('~')[0]); ptPoint.Add(new PointF(57.1F, 39F));
                        //ptString.Add(ls[iPage].Split('~')[1]); ptPoint.Add(new PointF(155F, 39F));
                        //ptString.Add(tb航班号.Text); ptPoint.Add(new PointF(57.1F, 50F));
                        //ptString.Add(tb乘机日.Text); ptPoint.Add(new PointF(155F, 50F));
                        //ptString.Add(tb航班号.Text); ptPoint.Add(new PointF(131.8F, 72.4F));
                        //ptString.Add(tb航班号.Text); ptPoint.Add(new PointF(47F, 72.4F));
                        ////ptString.Add(tbPhone.Text); ptPoint.Add(new PointF(44F, 90F));
                        //ptString.Add(tb航班号.Value.ToShortDateString()); ptPoint.Add(new PointF(106.4F, 84.3F));
                        //ptString.Add(tb航班号.Text); ptPoint.Add(new PointF(183.1F, 84.3F));
                        ptString.Add(this.cb险种条款.Text); ptPoint.Add(new PointF(59.7F * scale, 20.6F * scale));
                        ptString.Add(hs.eNumber); ptPoint.Add(new PointF(164.9F * scale, 20.6F * scale));
                        ptString.Add(ls[iPage].Split('~')[0]); ptPoint.Add(new PointF(59.7F * scale, 27.5F * scale));
                        ptString.Add(this.cb证件类型.Text + ls[iPage].Split('~')[1]); ptPoint.Add(new PointF(148.2F * scale, 27.5F * scale));
                        ptString.Add(this.tb航班号.Text); ptPoint.Add(new PointF(59.7F * scale, 34.7F * scale));
                        ptString.Add(this.tb乘机日.Text); ptPoint.Add(new PointF(131.2F * scale, 34.7F * scale));
                        ptString.Add(this.tb保险金额.Text); ptPoint.Add(new PointF(40.7F * scale, 50.4F * scale));
                        ptString.Add(this.tb保险费.Text); ptPoint.Add(new PointF(131.2F * scale, 41.5F * scale));
                        ptString.Add(this.dtp保险起始时间.Value.ToShortDateString() + " " + tb保险起始时间.Text); ptPoint.Add(new PointF(49.5F * scale, 72.9F * scale));
                        ptString.Add(this.dtp保险终止时间.Value.ToShortDateString() + " " + tb保险终止时间.Text); ptPoint.Add(new PointF(120.0F * scale, 72.9F * scale));
                        ptString.Add(this.tb受益人关系.Text); ptPoint.Add(new PointF(105.3F * scale, 80.5F * scale));
                        ptString.Add(this.tb受益人资料.Text); ptPoint.Add(new PointF(83.3F * scale, 85.7F * scale));
                        ptString.Add(this.tb填开单位.Text); ptPoint.Add(new PointF(46.9F * scale, 93.9F * scale));
                        ptString.Add(this.tb填开日期.Text); ptPoint.Add(new PointF(126.2F * scale, 93.9F * scale));
                        ptString.Add(this.tb经办人.Text); ptPoint.Add(new PointF(187.2F * scale, 93.9F * scale));

                        PrintHyx.PrintHyxPublic.PrintItems(ptString.ToArray(), ptPoint.ToArray(), o, ptFontEn, ptBrush, e);
                    }
                    iPage++;
                    if (iPage < ls.Count)
                    {
                        e.HasMorePages = true;
                    }
                    else
                    {
                        e.HasMorePages = false;
                    }
                }
            }
        }
Example #6
0
        private void bt_Print_Click(object sender, EventArgs e)
        {
            save_phone_addr();
            if (tb_NO.Text.Trim().Length != 10)
            {
                MessageBox.Show("保单号长度错误,需10位");
                return;
            }
            try
            {
                long.Parse(tb_NO.Text.Trim());
            }
            catch
            {
                MessageBox.Show("保单号只能为数字");
                return;
            }
            if (cb_Name.Text.Trim() == "")
            {
                MessageBox.Show("姓名不能为空");
                return;
            }
            if (tb_CardNo.Text.Trim() == "")
            {
                MessageBox.Show("证件号码不能为空");
                return;
            }
            this.tb_RandomNo.Text = System.DateTime.Now.Year.ToString().Remove(1, 1) + EagleAPI.GetRandom62();
            if (!GlobalVar.b_OffLine)
            {
                if (cb_Name.Text != GlobalVar.HYXTESTPRINT)
                {
                    HyxStructs hs = new HyxStructs();
                    hs.UserID           = GlobalVar.loginName;
                    hs.eNumber          = tb_RandomNo.Text;
                    hs.IssueNumber      = tb_NO.Text;
                    hs.NameIssued       = cb_Name.Text;
                    hs.CardType         = "航班号" + tbFlightNo.Text + "乘机日" + tbFlightDate.Text;
                    hs.CardNumber       = tb_CardNo.Text;
                    hs.Remark           = "B01";//5"华安交通意外伤害保险";B01
                    hs.IssuePeriod      = "";
                    hs.IssueBegin       = dtp_Start.Value.ToShortDateString() + " 00:00:00";
                    hs.IssueEnd         = dtp_End.Value.ToShortDateString() + " 00:00:00";
                    hs.SolutionDisputed = "";
                    hs.NameBeneficiary  = tb_Benefit.Text;
                    hs.Signature        = this.tb_Signature.Text;
                    hs.SignDate         = dtp_Date.Value.ToShortDateString();
                    hs.InssuerName      = "";
                    hs.Pnr = this.tb_PNR.Text;
                    if (!hs.SubmitInfo())
                    {
                        MessageBox.Show("数据提交失败!请检查保单号是否已被使用,或网络是否正常!");
                        return;
                    }
                }
            }

            PrintDialog pd = new PrintDialog();

            pd.Document = ptDoc;
            DialogResult dr = pd.ShowDialog();

            if (dr == DialogResult.OK)
            {
                ptDoc.Print();
            }
        }
Example #7
0
        private void bt_Print_Click(object sender, EventArgs e)
        {
            if (dtp保险起始时间.Value < DateTime.Today)
            {
                MessageBox.Show("保险起始日期不能早于今日!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            try
            {
                if (DateTime.Parse(tb乘机日.Text.Trim()) < DateTime.Today)
                {
                    MessageBox.Show("乘机日期不能早于当前日期!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }
            catch
            {
                MessageBox.Show("乘机日期填写格式有误,请核对!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (bLastString == cb被保险人姓名.Text && cb被保险人姓名.Text != "")
            {
                if (MessageBox.Show(bLastString + "->已经打印,是否再打印一张?", "警告", MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    return;
                }
            }
            //bt_Print.Enabled = false;
            Application.DoEvents();
            try
            {
                bLianxu = false;
                try
                {
                    save_cfg();
                }
                catch (Exception ee)
                {
                    MessageBox.Show(ee.Message + "save_cfg()");
                }
                if (insuranceNumberLength == 0)
                {
                    MessageBox.Show("未设置对应险种的保单序号长度insuranceNumberLength");
                    return;
                }
                if (tb保单序号.Text.Trim().Length != insuranceNumberLength)
                {
                    if (insuranceType == "B09" || insuranceType == "B0D")
                    {
                        ;
                    }
                    else
                    {
                        MessageBox.Show("保单序号长度错误," + insuranceNumberLength.ToString() + "位");
                        return;
                    }
                }
                try
                {
                    long.Parse(tb保单序号.Text.Trim());
                }
                catch
                {
                    if ((insuranceType == "B09") || (insuranceType == "B0D"))
                    {
                        ;
                    }
                    else
                    {
                        MessageBox.Show("保单序号只能为数字");

                        return;
                    }
                }
                if (cb被保险人姓名.Text.Trim() == "")
                {
                    MessageBox.Show("姓名不能为空");
                    return;
                }
                if (tb证件号.Text.Trim() == "")
                {
                    MessageBox.Show("证件号码不能为空");
                    return;
                }
                try
                {
                    DateTime dtTemp = DateTime.Parse(tb乘机日.Text.Trim());
                    if (dtTemp.Year != DateTime.Now.Year)
                    {
                        if (MessageBox.Show("乘机日期:" + tb乘机日.Text + "   请确认!", "注意", MessageBoxButtons.OKCancel) != DialogResult.OK)
                        {
                            return;
                        }
                    }
                }
                catch
                {
                    if (bhyx)
                    {
                        MessageBox.Show("乘机日期格式错误,如2007-4-2");
                        return;
                    }
                }
                tb保单号码.Text = eNumberHead + EagleAPI.GetRandom62();
                if (insuranceType == "B08")
                {
                    tb保单号码.Text = eNumberHead + DateTime.Now.Date.ToString("yyyyMMdd") + tb保单序号.Text;
                }
                if (paperHeight == 0 || paperWidth == 0)
                {
                    MessageBox.Show("未设置打印纸的宽与高paperHeight,paperWidth");
                    return;
                }
                if (!GlobalVar.b_OffLine)
                {
                    if (cb被保险人姓名.Text.Trim() != GlobalVar.HYXTESTPRINT)
                    {
                        HyxStructs hs = new HyxStructs();
                        hs.UserID           = GlobalVar.loginName;
                        hs.eNumber          = tb保单号码.Text;
                        hs.IssueNumber      = tb保单序号.Text;
                        hs.NameIssued       = cb被保险人姓名.Text;
                        hs.CardType         = "航班号" + tb航班号.Text + "乘机日" + tb乘机日.Text;;
                        hs.CardNumber       = tb证件号.Text;
                        hs.Remark           = insuranceType;                                    //保险种类别名代码B06
                        hs.IssuePeriod      = "";
                        hs.IssueBegin       = (bhyx ? tb乘机日.Text : dtp保险起始时间.Value.ToString()); //必须为时间串
                        hs.IssueEnd         = (bhyx ? tb乘机日.Text : dtp保险终止时间.Value.ToString()); //必须为时间串
                        hs.SolutionDisputed = "";
                        hs.NameBeneficiary  = tb受益人资料.Text + tb受益人关系.Text;
                        hs.Signature        = tb经办人.Text;  // tbSignatureDate.Text;
                        hs.SignDate         = tb填开日期.Text; //dtp_Date.Value.ToShortDateString();
                        hs.InssuerName      = "";
                        hs.Pnr = tbPnr.Text;

                        bSubmitting   = true;
                        bt_Print.Text = "提交中………………请稍等";
                        Application.DoEvents();
                        //while (this.insuranceType=="B07" && GlobalVar.serverAddr== GlobalVar.ServerAddr.HangYiWang)
                        //{
                        //    try
                        //    {
                        //        string ddd = "adksfj";
                        //        DateTime eee = DateTime.Parse(ddd);
                        //    }
                        //    catch (Exception ex)
                        //    {
                        //        MessageBox.Show(ex.Message);
                        //    }
                        //}
                        if (insuranceType == "B09" || insuranceType == "B0D")
                        {
                            EagleWebService.wsKernal ws = new EagleWebService.wsKernal(GlobalVar.WebServer);
                            NewPara np = new NewPara();
                            np.AddPara("cm", "SubmitEagleIns");
                            np.AddPara("UserAccount", "testaccount");
                            np.AddPara("UserPassword", "testpassword");
                            np.AddPara("CardIdNumber", "身份证号");
                            np.AddPara("FlightNumber", "航班号");
                            np.AddPara("FlightDate", "乘机日");
                            np.AddPara("BenefitRelation", "受益人关系");
                            np.AddPara("BenefitZiliao", "受益人资料");
                            np.AddPara("Telephone", "电话号码");
                            np.AddPara("Name", "被保险人名");
                            np.AddPara("PrintHead", "台头" + insuranceType);


                            string                    strReq = np.GetXML();
                            string                    strRet = ws.getEgSoap(strReq);
                            EP.WebService             epws   = new EP.WebService();
                            EP.WebServiceReturnEntity epret  = new EP.WebServiceReturnEntity();
                            if (insuranceType == "B09")
                            {
                                epret = epws.Purchase(GlobalVar2.bxUserAccount, GlobalVar2.bxPassWord,
                                                      lb公司名称.Text,
                                                      DateTime.Parse(tb乘机日.Text), tb航班号.Text, tb证件号.Text, cb被保险人姓名.Text, GlobalVar2.bxTelephone,
                                                      tb受益人关系.Text, tb受益人资料.Text);
                            }
                            else
                            {
                                epret = epws.PurchasePICC(GlobalVar2.bxUserAccount, GlobalVar2.bxPassWord,
                                                          lb公司名称.Text,
                                                          DateTime.Parse(tb乘机日.Text), tb航班号.Text, tb证件号.Text, cb被保险人姓名.Text, GlobalVar2.bxTelephone,
                                                          tb受益人关系.Text, tb受益人资料.Text);
                            }
                            bt_Print.Text = "打印(&P)";
                            if (!epret.Enabled)
                            {
                                MessageBox.Show(epret.ErrorMsg);
                                return;
                            }
                            else
                            {                                  //打印
                                tb保单号码.Text = epret.SerialNo;  //微机码
                                tb保单序号.Text = epret.CaseNo;    //单证号码
                                tb经办人.Text  = epret.AgentName; //加盟商明称
                            }
                        }
                        else
                        {
                            if (!hs.SubmitInfo())
                            {
                                bSubmitting   = false;
                                bt_Print.Text = "打印(&P)";
                                //MessageBox.Show("数据提交失败!请检查保单号是否已被使用,或网络是否正常!");
                                return;
                            }
                        }
                        bt_Print.Text = "打印(&P)";
                        bSubmitting   = false;
                    }
                }
                PrintDialog pd = new PrintDialog();
                EagleAPI.PrinterSetupCostom(ptDoc, paperWidth, paperHeight);
                pd.Document = ptDoc;
                //DialogResult dr = pd.ShowDialog();

                //if (dr == DialogResult.OK)
                {
                    ptDoc.Print();
                }
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
            }
            bLastString      = cb被保险人姓名.Text;
            bt_Print.Enabled = true;
        }
Example #8
0
        private void bt_Print_Click(object sender, EventArgs e)
        {
            #region 判断是否符合打印条件
            if (!EagleAPI.PrinterSetup(ptDoc))
            {
                return;
            }
            //if (tb_PNR.Text.Trim().Length != 5)
            //{
            //    MessageBox.Show("订座记录号错误");
            //    return;
            //}
            //任我游为10位数
            if (tb_NO.Text.Trim().Length != 10)
            {
                MessageBox.Show("保单号长度错误");
                return;
            }
            try
            {
                long.Parse(tb_NO.Text.Trim());
            }
            catch
            {
                MessageBox.Show("保单号只能为数字");
                return;
            }
            if (cb_Name.Text.Trim() == "")
            {
                MessageBox.Show("姓名不能为空");
                return;
            }
            if (tb_CardNo.Text.Trim() == "")
            {
                MessageBox.Show("证件号码不能为空");
                return;
            }
            //if (tb_Signature.Text.Trim() == "")
            //{
            //    MessageBox.Show("经办人不能为空");
            //    return;
            //}
            //if (tb_Insuror.Text.Trim() == "")
            //{
            //    MessageBox.Show("保险人不能为空");
            //    return;
            //}
            #endregion

            //6+凑足八位
            this.tb_RandomNo.Text = "PEED2006420105" + System.DateTime.Now.Month.ToString("x") + EagleAPI.GetRandom62();

#if newHYX
            if (!GlobalVar.b_OffLine)
            {
                if (cb_Name.Text != GlobalVar.HYXTESTPRINT)
                {
                    HyxStructs hs = new HyxStructs();
                    hs.UserID           = GlobalVar.loginName;
                    hs.eNumber          = tb_RandomNo.Text;
                    hs.IssueNumber      = tb_NO.Text;
                    hs.NameIssued       = cb_Name.Text;
                    hs.CardType         = "";
                    hs.CardNumber       = tb_CardNo.Text;
                    hs.Remark           = "001";//"中国人保财险-任我游";001
                    hs.IssuePeriod      = "7天";
                    hs.IssueBegin       = dtp_Start.Value.ToShortDateString() + " 00:00:00";
                    hs.IssueEnd         = dtp_End.Value.ToShortDateString() + " 23:59:59";
                    hs.SolutionDisputed = cb_Method.Text;
                    hs.NameBeneficiary  = tb_Benefit.Text;
                    hs.Signature        = this.tb_Signature.Text;
                    hs.SignDate         = dtp_Date.Value.ToShortDateString();
                    hs.Pnr = this.tb_PNR.Text;
                    if (!hs.SubmitInfo())
                    {
                        MessageBox.Show("数据提交失败!请检查保单号是否已被使用,或网络是否正常!");
                        return;
                    }
                }
            }
#else
            #region   数据
            if (conn.State != ConnectionState.Connecting)
            {
                conn.Close();
                try
                {
                    conn.Open();
                }
                catch
                {
                    MessageBox.Show("数据库连接失败!!");
                    Application.Exit();
                }
            }

            string cmdstring = "insert t_hyx (UserID,InsuranceName,PNR,[NO],Policy,IssuedName,IDCard,FlightNo,";
            cmdstring += "FlyDate,EffictiveTime,EffictiveStart,EffictiveEnd,Beneficiary,BeneficiaryInfo,IssuedDate,";
            cmdstring += "IssuedBy) VALUES ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}')";
            cmdstring  = string.Format(cmdstring, GlobalVar.loginName, "中国人保财险-任我游", tb_PNR.Text, tb_RandomNo.Text, tb_NO.Text,
                                       cb_Name.Text, this.tb_CardNo.Text, "", "", "7天",
                                       dtp_Start.Value.ToShortDateString() + " 00:00:00",
                                       dtp_End.Value.ToShortDateString() + " 24:00:00",
                                       "", "", dtp_Date.Value.ToString(), tb_Signature.Text);
            try
            {
                SqlCommand cmd = new SqlCommand(cmdstring, conn);
                if (cmd.ExecuteNonQuery() != 1)
                {
                    MessageBox.Show("数据上传失败!");
                    return;
                }
            }
            catch
            {
                MessageBox.Show("请正确输入!");
                return;
            }
            #endregion
#endif
            #region 打印
            PrintDialog pd = new PrintDialog();
            pd.Document = ptDoc;
            DialogResult dr = pd.ShowDialog();
            if (dr == DialogResult.OK)
            {
                ptDoc.Print();
            }
            #endregion
        }