void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { busy.IsBusy = false; // 没有出错 if (e.Error == null) { //把数据转换成JSON JsonObject item = JsonValue.Parse(e.Result) as JsonObject; if (item.ContainsKey("error")) { string error = item["error"]; MessageBox.Show("交费失败:" + error); return; } // 把交易编号、交易日期写入打印界面 SeriaNumber Seriabx = (SeriaNumber)FrameworkElementExtension.FindResource(this, "Seriabx"); if (Seriabx == null) { MessageBox.Show("无法获取编号产生器信息,请重新登陆后操作!"); return; } //ui_sellid.Text = Seriabx.Key.ToString() + item["id"].ToString(); //把收费id放到收费对象 GeneralObject retsell = (GeneralObject)(from r in loader.Res where r.Name.Equals("retsell") select r).First(); retsell.FromJson(item); GeneralObject printobj = aofengprint.DataContext as GeneralObject; printobj.FromJson(item); //string date = (string)item["f_deliverydate"]; //ui_day.Text = date; //保存发票信息 GeneralObject fpinfosobj = (GeneralObject)(from r in loader.Res where r.Name.Equals("fpinfosobj") select r).First(); fpinfosobj.SetPropertyValue("f_fapiaostatue", "已用", true); fpinfosobj.Save(); // 调用打印 GoldTax tax = (GoldTax)(from r in loader.Res where r.Name.Equals("tax") select r).First(); //气费大于0,打印税票 if (tax.IsInit && tax.ListNumber != null && Int32.Parse(tax.ListNumber.Split(new char[] { '|' })[0]) > 0) { tax.Invoice(); } else { print.TipPrint(); } } else { // 提示出错 MessageBox.Show("交易失败,链接错误!如果继续失败,请联系系统管理员。"); // 清除界面数据 Clear(); } }
public void invok(string msg) { String GS = GT.RetCode.ToString(); if (GS.Equals("1011")) { GT.InvInfoInit(); //初始化 GT.InfoKind = 2; GT.SellerAddress = "2"; // GT.InfoTypeCode = "6500143320"; //发票类别 GT.GetInfo(); //textBox2.Text = GT.InfoTypeCode; //textBox1.Text = GT.InfoNumber.ToString(); GT.InfoClientName = "开票企业名称"; //购方名称 GT.InfoClientTaxCode = "650105999990003"; //购方税号 GT.InfoClientBankAccount = "246234524"; //购方开户账号 GT.InfoClientAddressPhone = "新疆"; //购方地址 //GT.InfoSellerBankAccount = ""; //销方开户行 GT.InfoSellerAddressPhone = ""; //销方地址 GT.InfoTaxRate = 3; //税率 GT.InfoNotes = "新A79972"; //备注 GT.InfoInvoicer = "admin"; //开票人 GT.InfoChecker = "崔杰"; //复核人 GT.InfoCashier = "崔浩"; //收款人 //GT.InfoListName = "详见销货清单"; //明细数据\ GT.ClearInvList(); GT.InvListInit(); //初始化明细 //if ("是否含税" == "含税") // { // GT.ListPriceKind = 1; // } // else // { // GT.ListPriceKind = 0; // } GT.ListPriceKind = 1; GT.ListGoodsName = "细绒棉"; //名称 GT.ListStandard = "3128"; //规格 GT.ListUnit = "KG"; //规格 GT.ListNumber = 2; //数量 GT.ListPrice = 100; //单价 GT.ListAmount = 200; //金额 GT.AddInvList(); GT.Invoice(); //发票开具 //textBox3.Text = GT.InfoNumber.ToString(); if (GT.RetCode.ToString() == "4001") // 传入发票数据不合法 { //"传入发票数据不合法", "信息提示"; } else if (GT.RetCode.ToString() == "4002") //开票前金税卡状态错误 { // MessageBox.Show("开票前金税卡状态错误", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); //保存发票ToolStripMenuItem.Enabled = false; } else if (GT.RetCode.ToString() == "4003") //金税卡开票调用错误 { // MessageBox.Show("金税卡开票调用错误,请确认组件版本号!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); //保存发票ToolStripMenuItem.Enabled = false; } else if (GT.RetCode.ToString() == "4004") //开票后金税卡状态错误 { // MessageBox.Show("开票后金税卡状态错误", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); //保存发票ToolStripMenuItem.Enabled = false; } else if (GT.RetCode.ToString() == "4011") //开票成功 { GT.GoodsListFlag = 0; GT.PrintInv(); if (GT.RetCode == 5001) { // MessageBox.Show("发票打印失败,失败原因:未找到发票,请先保存发票", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (GT.RetCode == 5011) { // MessageBox.Show("发票打印成功!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); //if (GetFPStyle == "发票") //{ // toolStripButton2_Click(null, null); //} } else if (GT.RetCode == 5012) { // MessageBox.Show("发票打印失败,失败原因:未打印", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (GT.RetCode == 5013) { // MessageBox.Show("发票打印失败!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } }
public int InvoiceBill() { _InvoiceRetInfo.sRetInfoTypeCode = "0"; _InvoiceRetInfo.sRetInfoNumber = 0; MyTax.InfoKind = iInvType; iResult = 0; if (dtInvocieDetail.Rows.Count > 0) { if (InvoiceBillHeader() == 1) { return(1); } if (InvoiceBillDetail() == 1) { return(1); } int iRetCode = 0; MyTax.Invoice(); iRetCode = MyTax.RetCode; if (iRetCode == 4011) { _InvoiceRetInfo.dRetInfoAmount = MyTax.InfoAmount; _InvoiceRetInfo.dRetInfoTaxAmount = MyTax.InfoTaxAmount; _InvoiceRetInfo.dRetInfoInvDate = MyTax.InfoDate; _InvoiceRetInfo.dRetInfoMonth = MyTax.InfoMonth; _InvoiceRetInfo.sRetInfoTypeCode = MyTax.InfoTypeCode; _InvoiceRetInfo.sRetInfoNumber = MyTax.InfoNumber; _InvoiceRetInfo.sRetGoodsListFlag = MyTax.GoodsListFlag; } else { sRetMsg = iRetCode.ToString() + " 开票失败"; if (iRetCode == 4001) { sRetMsg = iRetCode.ToString() + " 传入发票数据不合法"; return(1); } if (iRetCode == 4002) { sRetMsg = iRetCode.ToString() + " 开票前金税卡状态错"; return(1); } if (iRetCode == 4003) { sRetMsg = iRetCode.ToString() + " 金税卡开票调用错误"; return(1); } if (iRetCode == 4001) { sRetMsg = iRetCode.ToString() + " 开票后取金税卡状态错"; return(1); } if (iRetCode == 4012) { sRetMsg = iRetCode.ToString() + " 开票失败"; return(1); } if (iRetCode == 4013) { sRetMsg = iRetCode.ToString() + " 所开发票已作废"; return(1); } iResult = 1; } } return(iResult); }
public int InvoiceBill() { //MyTax //int iRetCode = 0; sRetInfoTypeCode = "0"; sRetInfoNumber = 0; MyTax.InfoKind = iInfoKind; int iRetrun = 0; if (iCurrentItemId != -1) { fGetDetailCount(iCurrentItemId); InvoiceBillHeader(iCurrentItemId); if (InvoiceBillDetail(iCurrentItemId) == 1) { return(1); } int iRetCode = 0; MyTax.Invoice(); iRetCode = MyTax.RetCode; if (iRetCode == 4011) { dRetInfoAmount = MyTax.InfoAmount; dRetInfoTaxAmount = MyTax.InfoTaxAmount; dRetInfoInvDate = MyTax.InfoDate; dRetInfoMonth = MyTax.InfoMonth; sRetInfoTypeCode = MyTax.InfoTypeCode; sRetInfoNumber = MyTax.InfoNumber; sRetGoodsListFlag = MyTax.GoodsListFlag; MyTax.GoodsListFlag = 0; if (chkPrtDlg.Checked) { MyTax.InfoShowPrtDlg = 1; } else { MyTax.InfoShowPrtDlg = 0; } MyTax.PrintInv(); if ((MyTax.RetCode != 5001) && MyTax.RetCode != 5011 && MyTax.RetCode != 5012 && MyTax.RetCode != 5013) { sRetMsg = MyTax.RetCode.ToString() + " 打印失败:其他原因!"; iRetrun = 1; return(1); } if (MyTax.RetCode == 5001) { sRetMsg = MyTax.RetCode.ToString() + " 未找到发票或清单"; iRetrun = 1; return(1); } if (MyTax.RetCode == 5011) { sRetMsg = MyTax.RetCode.ToString() + " 打印成功"; iRetrun = 0; } if (MyTax.RetCode == 5012) { sRetMsg = MyTax.RetCode.ToString() + " 未打印"; iRetrun = 0; return(1); } if (MyTax.RetCode == 5013) { sRetMsg = MyTax.RetCode.ToString() + " 打印失败"; iRetrun = 1; return(1); } } else { sRetMsg = iRetCode.ToString() + " 开票失败"; if (iRetCode == 4001) { sRetMsg = iRetCode.ToString() + " 传入发票数据不合法"; return(1); } if (iRetCode == 4002) { sRetMsg = iRetCode.ToString() + " 开票前金税卡状态错"; return(1); } if (iRetCode == 4003) { sRetMsg = iRetCode.ToString() + " 金税卡开票调用错误"; return(1); } if (iRetCode == 4001) { sRetMsg = iRetCode.ToString() + " 开票后取金税卡状态错"; return(1); } if (iRetCode == 4012) { sRetMsg = iRetCode.ToString() + " 开票失败"; return(1); } if (iRetCode == 4013) { sRetMsg = iRetCode.ToString() + " 所开发票已作废"; return(1); } iRetrun = 1; } } return(iRetrun); }