예제 #1
0
        private void FormExcelToXml_Load(object sender, EventArgs e)
        {
            docMgr = new DocumentManager(App.Instance.GetSqliteHelper());

            cbInvoiceType.Items.Add(InvoiceTypeWrapper.GetText(InvoiceType.Electric));
            cbInvoiceType.Items.Add(InvoiceTypeWrapper.GetText(InvoiceType.Special));
            cbInvoiceType.Items.Add(InvoiceTypeWrapper.GetText(InvoiceType.Common));
            cbInvoiceType.SelectedIndex = 0;
        }
예제 #2
0
        private void btnBuild_Click(object sender, EventArgs e)
        {
            string      excelFilepath = tbExcelFilepath.Text;
            string      xmlFilepath   = tbXmlFilepath.Text;
            InvoiceType invoiceType   = InvoiceTypeWrapper.TextOf(cbInvoiceType.Text);

            Dictionary <string, List <DocumentExcel> > dict = docMgr.ParseExcel(excelFilepath);
            List <Document> list   = docMgr.ConvertToDocument(dict);
            InvokeResult    result = docMgr.SaveDocument(list);

            //ExcelToXml excelToXml = new ExcelToXml();
            //InvokeResult result = excelToXml.ConvertExcelToXml(excelFilepath, xmlFilepath, invoiceType);
            if (result.State)
            {
                MessageBox.Show("开票文件已生成:" + xmlFilepath, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("开票文件生成失败。" + result.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #3
0
        public bool Insert(Document doc)
        {
            string sql = "insert into tbl_document " +
                         "(IssueInvoiceType,ImportDate,DocumentNo,BuyerName,BuyerTaxCode," +
                         "BuyerAddressTel,BuyerBankAccountNo,Memo,Maker,Checker, " +
                         "Payee,TaxCatalogVersion,IsIncludeTax,SellerName,SellerTaxCode," +
                         "SellerAddressTel,SellerBankAccountNo,OriginalInvoiceCode,OriginalInvoiceNo) " +
                         "values " +
                         "(@IssueInvoiceType,@ImportDate,@DocumentNo,@BuyerName,@BuyerTaxCode," +
                         "@BuyerAddressTel,@BuyerBankAccountNo,@Memo,@Maker,@Checker, " +
                         "@Payee,@TaxCatalogVersion,@IsIncludeTax,@SellerName,@SellerTaxCode," +
                         "@SellerAddressTel,@SellerBankAccountNo,@OriginalInvoiceCode,@OriginalInvoiceNo) ";

            SQLiteParameter[] ps = new SQLiteParameter[] {
                new SQLiteParameter("@IssueInvoiceType", InvoiceTypeWrapper.GetValue(doc.IssueInvoiceType)),
                new SQLiteParameter("@ImportDate", doc.ImportDate),
                new SQLiteParameter("@DocumentNo", doc.No),
                new SQLiteParameter("@BuyerName", doc.BuyerName),
                new SQLiteParameter("@BuyerTaxCode", doc.BuyerTaxCode),
                new SQLiteParameter("@BuyerAddressTel", doc.BuyerAddressTel),
                new SQLiteParameter("@BuyerBankAccountNo", doc.BuyerBankAccountNo),
                new SQLiteParameter("@Memo", doc.Memo),
                new SQLiteParameter("@Maker", doc.Maker),
                new SQLiteParameter("@Checker", doc.Checker),
                new SQLiteParameter("@Payee", doc.Payee),
                new SQLiteParameter("@TaxCatalogVersion", doc.TaxCatalogVersion),
                new SQLiteParameter("@IsIncludeTax", doc.IsIncludeTax),
                new SQLiteParameter("@SellerName", doc.SellerName),
                new SQLiteParameter("@SellerTaxCode", doc.SellerTaxCode),
                new SQLiteParameter("@SellerAddressTel", doc.SellerAddressTel),
                new SQLiteParameter("@SellerBankAccountNo", doc.SellerBankAccountNo),
                new SQLiteParameter("@OriginalInvoiceCode", doc.OriginalInvoiceCode),
                new SQLiteParameter("@OriginalInvoiceNo", doc.OriginalInvoiceNo)
            };

            return(sqlite.ExecuteInsert(sql, ps));
        }