Пример #1
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            int recordCount = bPurchase.GetPurchaseRecordCount(GetCondition());

            _currentDt = bPurchase.GetPurchaseList(GetCondition(), "", 1, recordCount).Tables[0];
            if (isSearch && _currentDt != null)
            {
                SaveFileDialog sf = new SaveFileDialog();
                sf.FileName = "LZ_PURCHASE_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx";
                sf.Filter   = "(文件)|*.xls;*.xlsx";
                string header = "画面明细编号\t采购内部编号\t供应商编号\t供应商名称\t供应商类型\t供应商类型名称\t供应商类型名称\t国外发票No\t国外发票金额\t国内发票No\t" +
                                "国内发票金额\t付款状态\t付款状态名称\t开票日期\t付款预定日\t通货编号\t通货名称\t状态\t\n";
                if (sf.ShowDialog(this) == DialogResult.OK)
                {
                    _currentDt.Columns.Remove("INVOICE_No");
                    _currentDt.Columns.Remove("INVOICE_NO_AMOUNT");
                    if (_currentDt != null)
                    {
                        int result = CExport.DataTableToCsv(_currentDt, header, sf.FileName);
                        if (result == 0)
                        {
                            MessageBox.Show("导出成功!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                }
            }
        }
Пример #2
0
 /// <summary>
 /// 导出
 /// </summary>
 private void MasterToolBar_DoExport_Click(object sender, EventArgs e)
 {
     _currentDt = bSupplier.GetList(GetConduction()).Tables[0];
     if (isSearch && _currentDt != null)
     {
         foreach (DataRow row in _currentDt.Rows)
         {
             try
             {
                 if (row["CREATE_USER"] != null && bCommon.GetBaseMaster("USER", CConvert.ToString(row["CREATE_USER"])) != null)
                 {
                     row["CREATE_USER"] = bCommon.GetBaseMaster("USER", CConvert.ToString(row["CREATE_USER"])).Name;
                 }
                 if (row["LAST_UPDATE_USER"] != null && bCommon.GetBaseMaster("USER", CConvert.ToString(row["LAST_UPDATE_USER"])) != null)
                 {
                     row["LAST_UPDATE_USER"] = bCommon.GetBaseMaster("USER", CConvert.ToString(row["LAST_UPDATE_USER"])).Name;
                 }
             }
             catch { }
         }
         int result = CExport.DataTableToExcel(_currentDt, CConstant.SUPPLIER_HEADER, CConstant.SUPPLIER_COLUMNS, "SUPPLIER", "SUPPLIER");
         if (result == CConstant.EXPORT_SUCCESS)
         {
             MessageBox.Show("数据已经成功导出!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else if (result == CConstant.EXPORT_FAILURE)
         {
             MessageBox.Show("数据导出失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     else
     {
         MessageBox.Show("没有可以导出的数据。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #3
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            _currentDt = bRerceipt.GetPrintList(GetConduction()).Tables[0];
            if (_currentDt.Rows.Count > 0 && isSearch)
            {
                //SaveFileDialog sf = new SaveFileDialog();
                //sf.FileName = "LZ_RECEIPT_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
                //sf.Filter = "(文件)|*.xls;*.xlsx";

                //string header = "入库编号\t采购订单编号\t入库行号\t供应商编号\t供应商名称\t入库仓库编号\t入库仓库名称\t" +
                //                "公司编号\t公司名称\t货币编号\t货币名称\t商品编号\t商品名称\t采购数量\t入库预定数量\t入库数量\t" +
                //                "入库日期\t发票编号\t单位编号\t单位名称\t单价\t不含税金额\t税率\t税金\t含税金额\t明细状态\t创建人\t创建时间\t最后更新人\t最后更新时间\t\n";
                //if (sf.ShowDialog(this) == DialogResult.OK)
                //{
                //    if (_currentDt != null)
                //    {
                //        int result = CommonExport.DataTableToCsv(_currentDt, header, sf.FileName);
                //        if (result == 0)
                //        {
                //            MessageBox.Show("成功!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                //        }
                //    }
                //}
                int result = CExport.DataTableToExcel(_currentDt, CConstant.RECEIPT_HEADER, CConstant.RECEIPT_COLUMNS, "RECEIPT", "RECEIPT");
                if (result == CConstant.EXPORT_SUCCESS)
                {
                    MessageBox.Show("数据已经成功导出!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else if (result == CConstant.EXPORT_FAILURE)
                {
                    MessageBox.Show("数据导出失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Пример #4
0
        /// <summary>
        /// 导出
        /// </summary>
        private void MasterToolBar_DoExport_Click(object sender, EventArgs e)
        {
            _currentDt = bSafetyStock.GetList(GetConduction()).Tables[0];
            if (isSearch && _currentDt != null)
            {
                foreach (DataRow row in _currentDt.Rows)
                {
                    try
                    {
                        if (row["CREATE_USER"] != null && bCommon.GetBaseMaster("USER", CConvert.ToString(row["CREATE_USER"])) != null)
                        {
                            row["CREATE_USER"] = bCommon.GetBaseMaster("USER", CConvert.ToString(row["CREATE_USER"])).Name;
                        }
                        if (row["LAST_UPDATE_USER"] != null && bCommon.GetBaseMaster("USER", CConvert.ToString(row["LAST_UPDATE_USER"])) != null)
                        {
                            row["LAST_UPDATE_USER"] = bCommon.GetBaseMaster("USER", CConvert.ToString(row["LAST_UPDATE_USER"])).Name;
                        }
                    }
                    catch { }
                }
                SaveFileDialog sf = new SaveFileDialog();
                sf.FileName = "LZ_SAFETY_STOCK_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
                sf.Filter   = "(文件)|*.xls;*.xlsx";

                string header = "仓库编号\t仓库名称\t商品编号\t商品名称\t单位编号\t单位名称\t安全在库数\t最大在库数\t最小采购数\t状态\t创建人员\t创建时间\t最后更新人\t最后更新时间\t\n";
                if (sf.ShowDialog(this) == DialogResult.OK)
                {
                    int result = CExport.DataTableToCsv(_currentDt, header, sf.FileName);
                    if (result == 0)
                    {
                        MessageBox.Show("导出成功!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
        }
Пример #5
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            _currentDt = bProductBuild.GetBuildSearchPrintList(GetConduction()).Tables[0];
            _currentDt.Columns.Add("STATUS");
            foreach (DataRow row in _currentDt.Rows)
            {
                if (CConvert.ToInt32(row["STATUS_FLAG"]) == CConstant.BUILD_STATUS)
                {
                    row["STATUS"] = "组成";
                }
            }
            _currentDt.Columns.Remove("STATUS_FLAG");
            if (_currentDt.Rows.Count > 0 && isSearch)
            {
                SaveFileDialog sf = new SaveFileDialog();
                sf.FileName = "HD_BUILD_SEARCH_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
                sf.Filter   = "(文件)|*.xls;*.xlsx";

                string header = "组成编号\t仓库编号\t仓库名称\t组成品编号\t组成品名称\t组成数量\t组成时间\t公司编号\t公司名称\t组成品单位编号\t组成品单位名称\t创建人\t创建时间\t最后更新人\t最后更新时间\t" +
                                "材料明细\t材料编号\t材料名称\t材料数量\t材料单位编号\t材料单位名称\t状态\t\n";
                if (sf.ShowDialog(this) == DialogResult.OK)
                {
                    if (_currentDt != null)
                    {
                        int result = CExport.DataTableToCsv(_currentDt, header, sf.FileName);
                        if (result == 0)
                        {
                            MessageBox.Show("成功!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                }
            }
        }
Пример #6
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            int recordCount = bPaymentMatch.GetPaymentMatchSearchRecordCount(GetCondition());

            _currentDt = bPaymentMatch.GetPaymentMatchSearchList(GetCondition(), "", 1, recordCount).Tables[0];
            if (isSearch && _currentDt.Rows.Count > 0)
            {
                SaveFileDialog sf = new SaveFileDialog();
                sf.FileName = "LZ_PAYEMNT_MATCH_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx";
                sf.Filter   = "(文件)|*.xls;*.xlsx";

                string header = "序号\t付款编号\t供应商名称\t付款日期\t发票编号\t发票金额\t通货名称\t预付款金额\t付款金额\t状态\t\n";
                if (sf.ShowDialog(this) == DialogResult.OK)
                {
                    if (_currentDt != null)
                    {
                        int result = CExport.DataTableToCsv(_currentDt, header, sf.FileName);
                        if (result == 0)
                        {
                            MessageBox.Show("导出成功!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                }
            }
        }
Пример #7
0
 private void btnPrint_Click(object sender, EventArgs e)
 {
     _currentDt = bPurchaseOrder.GetPurchaseSupplementList(oldGetCondition).Tables[0];
     if (isSearch && _currentDt.Rows.Count > 0)
     {
         int result = CExport.DataTableToExcel(_currentDt, CConstant.PO_SUPPLEMENT_HEADER, CConstant.PO_SUPPLEMENT_COLUMNS, "PO_SUPPLEMENT", "PO_SUPPLEMENT");
         if (result == CConstant.EXPORT_SUCCESS)
         {
             MessageBox.Show("导出成功。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
 }
Пример #8
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            if (slipnumber != null && status_flag == CConstant.INVENTORY_END)
            {
                try
                {
                    //if (hashtb.Count > 0)
                    //{
                    int s = bInventory.UpdataInventory(slipnumber, hashtb, _userInfo.CODE, true);
                    if (s <= 0)
                    {
                        MessageBox.Show("盘点失败!");
                    }
                    else
                    {
                        MessageBox.Show("盘点成功!");
                    }
                    //}
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else if (slipnumber == null)
            {
                _currentdt = bInventory.GetStartPrintList(txtWarehouseCode.Text.Trim()).Tables[0];
                if (_currentdt.Rows.Count > 0 && isSearch)
                {
                    SaveFileDialog sf = new SaveFileDialog();
                    sf.FileName = "HD_INVENTORY_START_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
                    sf.Filter   = "(文件)|*.xls;*.xlsx";

                    string header = "仓库编号\t仓库名称\t商品编号\t商品名称\t商品规格\t单位编号\t单位名称\t在库数\t实际在库数\t状态\t创建人\t创建时间\t最后更新人\t最后更新时间\t\n";
                    if (sf.ShowDialog(this) == DialogResult.OK)
                    {
                        if (_currentdt != null)
                        {
                            int result = CExport.DataTableToCsv(_currentdt, header, sf.FileName);
                            if (result == 0)
                            {
                                MessageBox.Show("成功!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            }
                        }
                    }
                }
            }
        }
Пример #9
0
        //private void btnAlloation_Click(object sender, EventArgs e)
        //{
        //    try
        //    {
        //        string warehousecode = dgvData.SelectedRows[0].Cells["WAREHOUSE_CODE"].Value.ToString();
        //        string productcode = dgvData.SelectedRows[0].Cells["PRODUCT_CODE"].Value.ToString();
        //        if (warehousecode != null && productcode != null)
        //        {
        //            FrmStockReView frm = new FrmStockReView();
        //            frm.WAREHOUSE = warehousecode;
        //            frm.PRODUCT = productcode;
        //            frm.TYPE = CConstant.STOCK_ALLOATION_LIST;
        //            DialogResult resule = frm.ShowDialog(this);
        //            frm.Enabled = false;
        //            frm.Dispose();
        //        }
        //        else
        //        {
        //            MessageBox.Show("请选择正确的行!");
        //        }
        //    }
        //    catch
        //    {
        //        MessageBox.Show("请先选择一行!");
        //    }

        //}
        #endregion

        #region 导出
        private void btnPrint_Click(object sender, EventArgs e)
        {
            _currentDt = bStock.GetStockPrintList(oldGetCondition).Tables[0];
            if (_currentDt.Rows.Count > 0 && isSearch)
            {
                int result = CExport.DataTableToExcel(_currentDt, CConstant.STOCK_HEADER, CConstant.STOCK_COLUMNS, "STOCK", "STOCK");
                if (result == CConstant.EXPORT_SUCCESS)
                {
                    MessageBox.Show("数据已经成功导出!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else if (result == CConstant.EXPORT_FAILURE)
                {
                    MessageBox.Show("数据导出失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Пример #10
0
        /// <summary>
        /// 生产物料清单
        /// </summary>
        private void btnPrint_Click(object sender, EventArgs e)
        {
            string slipNumbers = "";

            foreach (DataGridViewRow dr in dgvData.Rows)
            {
                if (CConvert.ToBoolean(dr.Cells["CHK"].Value))
                {
                    slipNumbers += "'" + CConvert.ToString(dr.Cells["SLIP_NUMBER"].Value) + "',";
                }
            }
            if (slipNumbers.Length > 0)
            {
                slipNumbers = slipNumbers.Substring(0, slipNumbers.Length - 1);
            }
            else
            {
                MessageBox.Show("请先选择订单。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            SaveFileDialog sf = new SaveFileDialog();

            sf.FileName = "HD_BOM_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
            sf.Filter   = "(文件)|*.xls;*.xlsx";

            if (sf.ShowDialog(this) == DialogResult.OK)
            {
                DataTable dt = bProduce.GetBomList(slipNumbers).Tables[0];
                int       i  = 1;
                _bomDt.Rows.Clear();
                DataRow dr = null;
                foreach (DataRow row in dt.Rows)
                {
                    dr          = _bomDt.NewRow();
                    dr["序号"]    = i++;
                    dr["规格/参数"] = row["CODE"];
                    dr["名称"]    = row["NAME"];
                    dr["数量"]    = CConvert.ToDecimal(row["QUANTITY"]);
                    dr["备注"]    = "";
                    _bomDt.Rows.Add(dr);
                }
                CExport.DataTableToExcel_BOM(sf.FileName, _bomDt);
                MessageBox.Show("导出完成。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #11
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            int recordCount = bSales.GetReceiptMatchSearchRecordCount(GetCondition());

            _currentDt = bSales.GetReceiptMatchSearchList(GetCondition(), "", 1, recordCount).Tables[0];
            if (isSearch && _currentDt.Rows.Count > 0)
            {
                string RECEIPT_MATCH_HEADER  = "收款编号,请款公司编号,请款公司名称,收款日期,发票编号,发票金额,预收款金额,收款金额,通货";
                string RECEIPT_MATCH_COLUMNS = "SLIP_NUMBER,CUSTOMER_CLAIM_CODE, CUSTOMER_CLAIM_NAME,SLIP_DATE, INVOICE_NUMBER, INVOICE_AMOUNT,DEPOSIT_AMOUNT,TOTAL_AMOUNT,CURRENCY_NAME";

                int result = CExport.DataTableToExcel(_currentDt, RECEIPT_MATCH_HEADER, RECEIPT_MATCH_COLUMNS, "sheet1", "RECEIPT_MATCH");
                if (result == CConstant.EXPORT_SUCCESS)
                {
                    MessageBox.Show("导出成功!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Пример #12
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            DataTable printDataTable = bShipment.GetPrintList(currentConduction).Tables[0];

            if (isSearch && printDataTable.Rows.Count > 0)
            {
                int result = CExport.DataTableToExcel(printDataTable, CConstant.SHIPMENT_HEADER, CConstant.SHIPMENT_COLUMNS, "SHIPMENT", "SHIPMENT");
                if (result == CConstant.EXPORT_SUCCESS)
                {
                    MessageBox.Show("导出成功!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else if (result == CConstant.EXPORT_FAILURE)
                {
                    MessageBox.Show("数据导出失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Пример #13
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            int recordCount = bSales.GetSalesRecordCount(GetCondition());

            _currentDt = bSales.GetSalesList(GetCondition(), "", 1, recordCount).Tables[0];
            if (isSearch && _currentDt != null)
            {
                string SALES_HEADER = "发票系统编号,发票编号,请款公司编号,请款公司名称,开票日期,收款预定日,发票金额,未收款金额," +
                                      "收款状态,订单单号,订单金额,出库单号,出库金额,明细开票金额,通货";
                string SALES_COLUMNS = "SLIP_NUMBER,INVOICE_NUMBER,CUSTOMER_CLAIM_CODE,CUSTOMER_CLAIM_NAME,SLIP_DATE,CUSTOMER_CLAIM_DATE,INVOICE_AMOUNT,UN_RECEIPT_AMOUNT," +
                                       "PAYMENT_STATUS_NAME,ORDER_SLIP_NUMBER,ORDER_AMOUNT,SHIPMENT_SLIP_NUMBER,SHIPMENT_AMOUNT,INVOICE_AMOUNT,CURRENCY_NAME";
                int result = CExport.DataTableToExcel(_currentDt, SALES_HEADER, SALES_COLUMNS, "sheet1", "SALES");
                if (result == CConstant.EXPORT_SUCCESS)
                {
                    MessageBox.Show("导出成功!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Пример #14
0
 /// <summary>
 /// 导出
 /// </summary>
 private void btnExport_Click(object sender, EventArgs e)
 {
     if (_currentDt.Rows.Count > 0)
     {
         int result = CExport.DataTableToExcel(_currentDt, CConstant.AVAILABILITY_HEADER, CConstant.AVAILABILITY_COLUMNS, "AVAILABILITY", "AVAILABILITY");
         if (result == CConstant.EXPORT_SUCCESS)
         {
             MessageBox.Show("数据已经成功导出!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else if (result == CConstant.EXPORT_FAILURE)
         {
             MessageBox.Show("数据导出失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     else
     {
         MessageBox.Show("没有可以导出的数据。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #15
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            _currentDt = bProductBuild.GetBuildPrintList(GetConduction()).Tables[0];
            _currentDt.Columns.Add("PURCHASE_QUANTITY");
            _currentDt.Columns.Add("NO_ALLOATION");
            _currentDt.Columns.Add("STATUE_FLAG");

            foreach (DataRow rows in _currentDt.Rows)
            {
                rows["PURCHASE_QUANTITY"] = CConvert.ToDecimal(rows["QUANTITY"]) * CConvert.ToDecimal(txtQuantity.Text.Trim());
                decimal        alloationQuantity = bAlloation.GetAlloationQuantity(txtWarehouse.Text.Trim(), CConvert.ToString(rows["PRODUCT_PART_CODE"]));
                BaseStockTable stock             = new BaseStockTable();
                stock = bPurchaseOrder.GetStockModel(txtWarehouse.Text.Trim(), CConvert.ToString(rows["PRODUCT_PART_CODE"]));
                rows["NO_ALLOATION"] = stock.QUANTITY - alloationQuantity;
                if (CConvert.ToDecimal(rows["NO_ALLOATION"]) >= CConvert.ToDecimal(rows["PURCHASE_QUANTITY"]))
                {
                    rows["STATUE_FLAG"] = "OK";
                }
                else
                {
                    rows["STATUE_FLAG"] = "NG";
                }
            }
            if (_currentDt.Rows.Count > 0 && isSearch)
            {
                SaveFileDialog sf = new SaveFileDialog();
                sf.FileName = "HD_BUILD_PRINT_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
                sf.Filter   = "(文件)|*.xls;*.xlsx";

                string header = "组成品编号\t组成品名称\t材料编号\t材料名称\t材料规格\t单位编号\t单位名称\t最小构成数量\t需求数量\t未引当数量\t状况\t\n";
                if (sf.ShowDialog(this) == DialogResult.OK)
                {
                    if (_currentDt != null)
                    {
                        int result = CExport.DataTableToCsv(_currentDt, header, sf.FileName);
                        if (result == 0)
                        {
                            MessageBox.Show("成功!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                }
            }
        }
 /// <summary>
 /// 导出
 /// </summary>
 private void MasterToolBar_DoExport_Click(object sender, EventArgs e)
 {
     _currentDt = bCompositionProductsSpecification.GetList(GetConduction()).Tables[0];
     if (isSearch && _currentDt.Rows.Count > 0)
     {
         int result = CExport.DataTableToExcel(_currentDt, CConstant.MACHINE_HEADER, CConstant.MACHINE_COLUMNS, "MACHINE", "MACHINE");
         if (result == CConstant.EXPORT_SUCCESS)
         {
             MessageBox.Show("数据已经成功导出!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else if (result == CConstant.EXPORT_FAILURE)
         {
             MessageBox.Show("数据导出失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     else
     {
         MessageBox.Show("没有可以导出的数据。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #17
0
        /// <summary>
        /// 导出
        /// </summary>
        private void MasterToolBar_DoExport_Click(object sender, EventArgs e)
        {
            _currentDt = bCustomerReported.GetList(GetConduction()).Tables[0];
            if (isSearch && _currentDt != null)
            {
                SaveFileDialog sf = new SaveFileDialog();
                sf.FileName = "LZ_CUSTOMER_REPORTED_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
                sf.Filter   = "(文件)|*.xls;*.xlsx";

                string header = "客户编号\t客户名称\t报备客户编号\t报备客户名称\t报备日期\t有效日期\t状态\t创建人员\t创建时间\t最后更新人\t最后更新时间\t\n";
                if (sf.ShowDialog(this) == DialogResult.OK)
                {
                    int result = CExport.DataTableToCsv(_currentDt, header, sf.FileName);
                    if (result == 0)
                    {
                        MessageBox.Show("导出成功!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
        }
Пример #18
0
 /// <summary>
 /// 导出
 /// </summary>
 private void MasterToolBar_DoExport_Click(object sender, EventArgs e)
 {
     _currentDt = bProduct.GetList(GetConduction()).Tables[0];
     if (isSearch && _currentDt != null)
     {
         int result = CExport.DataTableToExcel(_currentDt, CConstant.PRODUCT_HEADER, CConstant.PRODUCT_COLUMNS, "PRODUCT", "PRODUCT");
         if (result == CConstant.EXPORT_SUCCESS)
         {
             MessageBox.Show("数据已经成功导出!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else if (result == CConstant.EXPORT_FAILURE)
         {
             MessageBox.Show("数据导出失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     else
     {
         MessageBox.Show("没有可以导出的数据。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #19
0
        private void btnExporte_Click(object sender, EventArgs e)
        {
            Hashtable ht = new Hashtable();

            ht.Add("&DATE", DateTime.Now.ToString("yyyy/MM/dd"));
            ht.Add("&TOTAL_AMOUNT", total);
            ht.Add("&PAYMENT_AMOUNT", payment);
            ht.Add("&NO_PAYMENT_AMOUNT", total - payment);

            if (dt.Rows.Count > 0)
            {
                SaveFileDialog sf = new SaveFileDialog();
                sf.FileName = "HD_PURCHASE_ORDER_TRACK_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
                sf.Filter   = "(文件)|*.xls;*.xlsx";

                if (sf.ShowDialog(this) == DialogResult.OK)
                {
                    int ret = CExport.DataTableToExcel_Purchase_Order_Track(@"rpt\HD_PURCHASE_ORDER_TRACK.xls", sf.FileName, dt, ht);
                    if (CConstant.EXPORT_FAILURE.Equals(ret))
                    {
                        MessageBox.Show("导出失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else if (CConstant.EXPORT_SUCCESS.Equals(ret))
                    {
                        MessageBox.Show("导出成功。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else if (CConstant.EXPORT_RUNNING.Equals(ret))
                    {
                        MessageBox.Show("文件正在运行,重新生成文件失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else if (CConstant.EXPORT_TEMPLETE_FILE_NOT_EXIST.Equals(ret))
                    {
                        MessageBox.Show("模版文件不存在。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
            }
            else
            {
                MessageBox.Show("明细信息不存在。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Пример #20
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            DataTable productionDt = dt as DataTable;

            if (productionDt != null)
            {
                int result = CExport.DataTableToExcel(productionDt, CConstant.PRODUCTION_HEADER, CConstant.PRODUCTION_COLUMNS, "PRODUCTION", "PRODUCTION");
                if (result == CConstant.EXPORT_SUCCESS)
                {
                    MessageBox.Show("数据已经成功导出!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else if (result == CConstant.EXPORT_FAILURE)
                {
                    MessageBox.Show("数据导出失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show("没有可以导出的数据。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #21
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            DataTable drawingDt = ds.Tables[0] as DataTable;

            if (drawingDt != null)
            {
                int result = CExport.DataTableToExcel(drawingDt, CConstant.DRAWING_HEADER, CConstant.DRAWING_COLUMNS, "DRAWING", "DRAWING");
                if (result == CConstant.EXPORT_SUCCESS)
                {
                    MessageBox.Show("数据已经成功导出!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else if (result == CConstant.EXPORT_FAILURE)
                {
                    MessageBox.Show("数据导出失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show("没有可以导出的数据。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #22
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            int recordCount = bSales.GetUnReceiptRecordCount(GetCondition());

            _currentDt = bSales.GetUnReceiptList(GetCondition(), "", 1, recordCount).Tables[0];
            if (isSearch && _currentDt.Rows.Count > 0)
            {
                SaveFileDialog sf = new SaveFileDialog();
                sf.FileName = "LZ_UNRECEIPT_MATCH_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx";
                sf.Filter   = "(文件)|*.xls;*.xlsx";

                string header = "画面明细编号\t销售内部编号\t请款公司编号\t请款公司名称\t开票日期\t发票编号\t发票金额\t通货\t收款预定日\t未收金额\t状态\t\n";
                if (sf.ShowDialog(this) == DialogResult.OK)
                {
                    //_currentDt.Columns.Remove("Row");
                    int result = CExport.DataTableToCsv(_currentDt, header, sf.FileName);
                    if (result == 0)
                    {
                        MessageBox.Show("导出成功!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
        }
Пример #23
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            _currentDt = bInventory.GetEndPrintList(GetConduction()).Tables[0];
            if (_currentDt.Rows.Count > 0 && isSearch)
            {
                SaveFileDialog sf = new SaveFileDialog();
                sf.FileName = "HD_INVENTORY_SEARCH_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
                sf.Filter   = "(文件)|*.xls;*.xlsx";

                string header = "盘点编号\t仓库编号\t仓库名称\t公司编号\t公司名称\t盘点开始日期\t盘点结束日期\t状态\t创建人\t" +
                                "创建时间\t最后更新人\t最后更新时间\t盘点明细行号\t商品编号\t商品名称\t在库数\t实际在库数\t明细状态\n";
                if (sf.ShowDialog(this) == DialogResult.OK)
                {
                    if (_currentDt != null)
                    {
                        int result = CExport.DataTableToCsv(_currentDt, header, sf.FileName);
                        if (result == 0)
                        {
                            MessageBox.Show("成功!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                }
            }
        }
Пример #24
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            _currentDt = bStock.GetDelayPrintList(GetConduction()).Tables[0];
            if (_currentDt.Rows.Count > 0 && isSearch)
            {
                SaveFileDialog sf = new SaveFileDialog();
                sf.FileName = "HD_DELAY_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
                sf.Filter   = "(文件)|*.xls;*.xlsx";

                string header = "商品编号\t商品名称\t商品规格\t单位编号\t单位名称\t商品分类编号\t商品分类名称\t在库数\t" +
                                "仓库编号\t仓库名称\t最后出库时间\t最后入库时间\t状态\t创建人\t创建时间\t最后更新人\t最后更新时间\t\n";
                if (sf.ShowDialog(this) == DialogResult.OK)
                {
                    if (_currentDt != null)
                    {
                        int result = CExport.DataTableToCsv(_currentDt, header, sf.FileName);
                        if (result == 0)
                        {
                            MessageBox.Show("成功!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                }
            }
        }
Пример #25
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            _currentDt = bStock.GetPrintList(GetConduction()).Tables[0];
            if (isSearch && _currentDt != null)
            {
                SaveFileDialog sf = new SaveFileDialog();
                sf.FileName = "HD_STOCK_ADJUSTMENT_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
                sf.Filter   = "(文件)|*.xls;*.xlsx";

                string header = "修改编号\t修改日期\t修改明细行号\t商品编号\t商品名称\t仓库编号\t仓库名称\t单位编号\t单位名称\t" +
                                "处分数\t理由编号\t理由\t公司编号\t公司名称\t状态\t创建人\t创建时间\t最后更新人\t最后更新时间\t\n";
                if (sf.ShowDialog(this) == DialogResult.OK)
                {
                    if (_currentDt != null)
                    {
                        int result = CExport.DataTableToCsv(_currentDt, header, sf.FileName);
                        if (result == 0)
                        {
                            MessageBox.Show("成功!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                }
            }
        }
Пример #26
0
        private void btnProduce_Click(object sender, EventArgs e)
        {
            if (CheckSure())
            {
                List <DataTable> orderList = new List <DataTable>();
                List <Hashtable> hashTable = new List <Hashtable>();
                DataTable        dt        = new DataTable();
                string[]         a         = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N" };
                dt.Columns.Add("NO");
                dt.Columns.Add("SLIPTYPE");
                dt.Columns.Add("X_1");
                dt.Columns.Add("X_2");
                dt.Columns.Add("SLIPNUMBER");
                dt.Columns.Add("CUSTOMER");
                dt.Columns.Add("DATE");
                dt.Columns.Add("MEMO");
                //dt.Columns.Add("QUANTITY");
                int i = 1;

                foreach (DataGridViewRow dgvr in dgvData.Rows)
                {
                    if (Convert.ToBoolean(dgvr.Cells["CHECK"].Value))
                    {
                        orderTable = bOrderHeader.GetModel(CConvert.ToString(dgvr.Cells["SLIP_NUMBER"].Value));

                        if (orderTable != null)
                        {
                            DataRow row = dt.NewRow();
                            row["NO"]         = i;
                            row["SLIPTYPE"]   = bCommon.GetBaseMaster("SLIP_TYPE", orderTable.SLIP_TYPE).Name;
                            row["SLIPNUMBER"] = orderTable.SLIP_NUMBER;
                            row["CUSTOMER"]   = orderTable.ENDER_CUSTOMER_NAME;
                            row["DATE"]       = orderTable.DUE_DATE;
                            row["MEMO"]       = orderTable.MEMO;
                            //row["QUANTITY"]= orderTable.
                            dt.Rows.Add(row);

                            DataTable dt2 = new DataTable();
                            dt2.Columns.Add("NO");
                            dt2.Columns.Add("PRODUCT_NAME");
                            dt2.Columns.Add("X_1");
                            dt2.Columns.Add("X_2");
                            dt2.Columns.Add("QUANTITY");
                            dt2.Columns.Add("X_3");
                            dt2.Columns.Add("X_4");
                            dt2.Columns.Add("X_5");
                            dt2.Columns.Add("X_6");
                            dt2.Columns.Add("X_7");
                            dt2.Columns.Add("X_8");
                            dt2.Columns.Add("MEMO");

                            int j = 1;
                            foreach (BllOrderLineTable line in orderTable.Items)
                            {
                                DataRow dr = dt2.NewRow();
                                dr["NO"]           = j++;
                                dr["PRODUCT_NAME"] = line.PRODUCT_NAME;
                                dr["QUANTITY"]     = (int)line.QUANTITY / orderTable.QUANTITY;
                                dr["MEMO"]         = line.MEMO;
                                dt2.Rows.Add(dr);
                            }
                            orderList.Add(dt2);

                            Hashtable ht = new Hashtable();
                            ht.Add("&SLIP_TYPE", bCommon.GetBaseMaster("SLIP_TYPE", orderTable.SLIP_TYPE).Name);
                            ht.Add("&QUANTITY", ((int)orderTable.QUANTITY).ToString() + "套");
                            //ht.Add("&YEAR", CConvert.ToDateTime(orderTable.SLIP_DATE).ToString("yyyy"));
                            //ht.Add("&MONTH", CConvert.ToDateTime(orderTable.SLIP_DATE).ToString("MM"));
                            ht.Add("&NAME", "生产通知单" + a[i - 1]);
                            ht.Add("&PONUMBER", orderTable.CUSTOMER_PO_NUMBER);
                            ht.Add("&DUEDATE", CConvert.ToDateTime(orderTable.DUE_DATE).ToString("yyyy") + "月" + CConvert.ToDateTime(orderTable.DUE_DATE).ToString("MM") + "日");
                            ht.Add("&SLIPNUMBER", orderTable.SLIP_NUMBER);
                            ht.Add("&CUSTOMER", orderTable.ENDER_CUSTOMER_NAME);
                            hashTable.Add(ht);
                            i++;
                        }
                    }
                }

                if (dt.Rows.Count > 0)
                {
                    SaveFileDialog sf = new SaveFileDialog();
                    sf.FileName = "HD_PRODUCTION_ORDERS_" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".xls";
                    sf.Filter   = "(文件)|*.xls;*.xlsx";
                    if (sf.ShowDialog(this) == DialogResult.OK)
                    {
                        if (dt.Rows.Count > 0)
                        {
                            int ret = CExport.DataTableToExcel_Production_Orders(@"rpt\HD_PRODUCTION_ORDERS.xls", sf.FileName, dt, orderList, hashTable);
                            if (CConstant.EXPORT_FAILURE.Equals(ret))
                            {
                                MessageBox.Show("导出失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            }
                            else if (CConstant.EXPORT_SUCCESS.Equals(ret))
                            {
                                MessageBox.Show("导出成功。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else if (CConstant.EXPORT_RUNNING.Equals(ret))
                            {
                                MessageBox.Show("文件正在运行,重新生成文件失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            }
                            else if (CConstant.EXPORT_TEMPLETE_FILE_NOT_EXIST.Equals(ret))
                            {
                                MessageBox.Show("模版文件不存在。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            }
                        }
                        else
                        {
                            MessageBox.Show("明细信息不存在。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("请先选择一张订单。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Пример #27
0
        private void btnInquirySheet_Click(object sender, EventArgs e)
        {
            if (dgvData.SelectedRows.Count > 0)
            {
                Hashtable       ht  = new Hashtable();
                DataTable       dt  = new DataTable();
                DataGridViewRow row = dgvData.SelectedRows[0];

                BllPurchaseOrderTable purchase = bPurchaseOrder.GetModel(CConvert.ToString(row.Cells["SLIP_NUMBER"].Value));
                BaseSupplierTable     supplier = bSupplier.GetModel(CConvert.ToString(row.Cells["SUPPLIER_CODE"].Value));
                if (purchase == null)
                {
                    purchase = new BllPurchaseOrderTable();
                }
                if (supplier == null)
                {
                    supplier = new BaseSupplierTable();
                }

                ht.Add("&SUPPLIER", supplier.NAME);
                ht.Add("&CONTACT_NAME", supplier.CONTACT_NAME);
                ht.Add("&MOBIL_NUMBER", supplier.MOBIL_NUMBER);
                ht.Add("&PHONE_NUMBER", supplier.PHONE_NUMBER);
                ht.Add("&FAX_NUMBER", supplier.FAX_NUMBER);

                dt.Columns.Add("No");
                dt.Columns.Add("SPEC");
                dt.Columns.Add("NAME");
                dt.Columns.Add("UNIT_NAME");
                dt.Columns.Add("QUANTITY");
                dt.Columns.Add("PRICE");
                dt.Columns.Add("TOTAL_AMOUNT");
                dt.Columns.Add("APPLICATION");
                dt.Columns.Add("MEMO");

                DataRow rows  = null;
                int     i     = 0;
                string  name  = "";
                decimal TOTAL = 0;
                foreach (BllPurchaseOrderLineTable POLTable in purchase.Items)
                {
                    rows       = dt.NewRow();
                    rows["No"] = POLTable.LINE_NUMBER;
                    BaseProductTable product = bProduct.GetModel(POLTable.PRODUCT_CODE);
                    if (product != null)
                    {
                        rows["SPEC"] = product.CODE;
                        rows["NAME"] = product.NAME;
                        if (i == 0)
                        {
                            name = product.NAME;
                        }
                        if (bCommon.GetBaseMaster("UNIT", POLTable.UNIT_CODE) != null)
                        {
                            rows["UNIT_NAME"] = bCommon.GetBaseMaster("UNIT", POLTable.UNIT_CODE).Name;
                        }
                    }
                    rows["QUANTITY"]     = (int)POLTable.QUANTITY;
                    rows["PRICE"]        = POLTable.PRICE;
                    rows["TOTAL_AMOUNT"] = POLTable.AMOUNT_INCLUDED_TAX;
                    rows["MEMO"]         = purchase.MEMO;
                    dt.Rows.Add(rows);
                    TOTAL += POLTable.AMOUNT_INCLUDED_TAX;
                    i++;
                }

                ht.Add("&TOTAL", TOTAL);
                SaveFileDialog sf = new SaveFileDialog();
                sf.FileName = "HD_INQUIRY_" + supplier.NAME + "_" + purchase.SLIP_DATE.ToString("yyyyMMdd") + ".xls";
                sf.Filter   = "(文件)|*.xls;*.xlsx";
                if (sf.ShowDialog(this) == DialogResult.OK)
                {
                    if (dt.Rows.Count > 0)
                    {
                        int ret = CExport.DataTableToExcel_IS(@"rpt\HD_INQUIRY.xls", sf.FileName, dt, ht);
                        if (CConstant.EXPORT_FAILURE.Equals(ret))
                        {
                            MessageBox.Show("导出失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                        else if (CConstant.EXPORT_SUCCESS.Equals(ret))
                        {
                            MessageBox.Show("导出成功。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else if (CConstant.EXPORT_RUNNING.Equals(ret))
                        {
                            MessageBox.Show("文件正在运行,重新生成文件失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                        else if (CConstant.EXPORT_TEMPLETE_FILE_NOT_EXIST.Equals(ret))
                        {
                            MessageBox.Show("模版文件不存在。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }
                    else
                    {
                        MessageBox.Show("明细信息不存在。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
            }
        }
Пример #28
0
        /// <summary>
        /// OEM销售成绩表
        /// </summary>
        private void ExportOEMSales()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("No");
            dt.Columns.Add("ORDER_SLIP_DATE");
            dt.Columns.Add("RECEIPT_SLIP_DATE");
            dt.Columns.Add("MACHINE_CODE");
            dt.Columns.Add("MACHINE_NAME");
            dt.Columns.Add("CHECK_NUMBER");
            dt.Columns.Add("CHECK_DATE");
            dt.Columns.Add("CUSTOMER_NAME");
            dt.Columns.Add("ENDER_CUSTOMER_NAME");
            dt.Columns.Add("ADDRESS");
            dt.Columns.Add("ADDRESS2");
            string where = GetOEMSalesConduction();

            DataTable salesTable = bInvoice.GetSalesProductInfo(where).Tables[0];
            DataRow   dr         = null;
            int       i          = 0;

            foreach (DataRow row in salesTable.Rows)
            {
                dr       = dt.NewRow();
                dr["No"] = i.ToString();
                dr["ORDER_SLIP_DATE"]     = row["SLIP_DATE"];
                dr["RECEIPT_SLIP_DATE"]   = row["CREATE_DATE_TIME"];
                dr["MACHINE_CODE"]        = row["SERIAL_NUMBER"];
                dr["MACHINE_NAME"]        = row["MACHINE_NAME"];
                dr["CHECK_NUMBER"]        = row["CHECK_NUMBER"];
                dr["CHECK_DATE"]          = row["CHECK_DATE"];
                dr["CUSTOMER_NAME"]       = row["CUSTOMER_NAME"];
                dr["ENDER_CUSTOMER_NAME"] = row["END_CUSTOMER_NAME"];
                dr["ADDRESS"]             = row["ADDRESS"];
                dr["ADDRESS2"]            = row["ADDRESS"];
                i++;
                dt.Rows.Add(dr);
            }

            Hashtable      ht = new Hashtable();
            SaveFileDialog sf = new SaveFileDialog();

            sf.FileName = "LZ_OEM_SALES_PERFORMANCE_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
            sf.Filter   = "(文件)|*.xls;*.xlsx";
            if (sf.ShowDialog(this) == DialogResult.OK)
            {
                if (dt.Rows.Count > 0)
                {
                    int ret = CExport.ExportOEMSales(@"rpt\OEM_SALES_PERFORMANCE.frx", sf.FileName, dt, ht);
                    if (CConstant.EXPORT_FAILURE.Equals(ret))
                    {
                        MessageBox.Show("导出失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else if (CConstant.EXPORT_SUCCESS.Equals(ret))
                    {
                        MessageBox.Show("导出成功。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else if (CConstant.EXPORT_RUNNING.Equals(ret))
                    {
                        MessageBox.Show("文件正在运行,重新生成文件失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else if (CConstant.EXPORT_TEMPLETE_FILE_NOT_EXIST.Equals(ret))
                    {
                        MessageBox.Show("模版文件不存在。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    this.Close();
                }
                else
                {
                    MessageBox.Show("明细信息不存在。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
        }
Пример #29
0
        /// <summary>
        ///  OEM制品管理表
        /// </summary>
        public void ExportOEMProduct()
        {
            //OEM制品管理表所需要的导出字段
            #region
            exportDt.Columns.Clear();
            exportDt.Columns.Add("MACHINE_CODE", Type.GetType("System.String"));                         //机械编号
            exportDt.Columns.Add("MACHINE_NAME", Type.GetType("System.String"));                         //机械名称
            exportDt.Columns.Add("BODY_PURCHASE_ORDER_SLIP_NUMBER", Type.GetType("System.String"));      //机械本体采购订单编号D:\龙泽ERP\ERP.WinUI\Finance\FrmSalesSearch.cs
            exportDt.Columns.Add("BODY_INVOICE_NUMBER_LOCAL", Type.GetType("System.String"));            //机械本体采购发票编号
            exportDt.Columns.Add("BODY_PURCHASE_SLIP_DATE", Type.GetType("System.String"));              //机械本体采购发票日期
            exportDt.Columns.Add("BODY_INVOICE_AMOUNT", Type.GetType("System.String"));                  //机械本体采购发票金额(含税)
            exportDt.Columns.Add("PART_PURCHASE_ORDER_SLIP_NUMBER", Type.GetType("System.String"));      //机械部件采购订单编号(国内)

            exportDt.Columns.Add("PART_INVOICE_NUMBER_LOCAL", Type.GetType("System.String"));            //机械部件采购发票编号(国内)
            exportDt.Columns.Add("PART_PURCHASE_SLIP_DATE", Type.GetType("System.String"));              //机械部件采购发票日期(国内)
            exportDt.Columns.Add("PART_INVOICE_AMOUNT", Type.GetType("System.Decimal"));                 //机械部件采购发票金额(含税)(国内)
            exportDt.Columns.Add("FOREIGN_PURCHASE_ORDER_SLIP_NUMBER", Type.GetType("System.String"));   //机械部件采购订单编号(国外)
            exportDt.Columns.Add("FOREIGN_PURCHASE_INVOICE_NUMBER", Type.GetType("System.String"));      //机械部件采购发票编号(国外)
            exportDt.Columns.Add("FOREIGN_PURCHASE_SLIP_DATE", Type.GetType("System.String"));           //机械部件采购发票日期(国外)

            exportDt.Columns.Add("FOREIGN_INVOICE_AMOUNT", Type.GetType("System.Decimal"));              //机械部件采购发票金额(含税)(国外)
            exportDt.Columns.Add("EXCHANGE_RATE", Type.GetType("System.Decimal"));                       //外币汇率

            exportDt.Columns.Add("RMB_INVOICE_AMOUNT", Type.GetType("System.Decimal"));                  //外币拆合人民币
            exportDt.Columns.Add("TAX_AMOUNT", Type.GetType("System.Decimal"));                          //税金
            exportDt.Columns.Add("TOTAL", Type.GetType("System.Decimal"));                               //小计

            exportDt.Columns.Add("TOTAL_AMOUNT", Type.GetType("System.Decimal"));                        //总金额(采购金额)
            exportDt.Columns.Add("ORDER_SLIP_NUMBER", Type.GetType("System.String"));                    //销售订单编号

            exportDt.Columns.Add("CUSTOMER_PO_NUMBER", Type.GetType("System.String"));                   //销售合同编号
            exportDt.Columns.Add("SHIPMENT_SLIP_DATE", Type.GetType("System.String"));                   //出库日期
            exportDt.Columns.Add("SALES_INVOICE_NUMBER", Type.GetType("System.String"));                 //销售发票NO
            exportDt.Columns.Add("ORDER_SLIP_DATE", Type.GetType("System.String"));                      //销售日期
            exportDt.Columns.Add("AMOUNT_WITHOUT_TAX", Type.GetType("System.Decimal"));                  //不含税金额
            exportDt.Columns.Add("TOTAL_BODY_AMOUNT", Type.GetType("System.Decimal"));                   //机械本体不含税金额
            exportDt.Columns.Add("PART_AMOUNT", Type.GetType("System.Decimal"));                         //机械部件不含税金额
            exportDt.Columns.Add("GROSS_PROFIT", Type.GetType("System.Decimal"));                        //利润
            exportDt.Columns.Add("CHECK_NUMBER", Type.GetType("System.String"));                         //检查编号
            exportDt.Columns.Add("CHECK_DATE", Type.GetType("System.String"));                           //检查日期
            exportDt.Columns.Add("CUSTOMER_NAME", Type.GetType("System.String"));                        //代理店名称
            exportDt.Columns.Add("ENDER_CUSTOMER_NAME", Type.GetType("System.String"));                  //需要家
            exportDt.Columns.Add("ADDRESS", Type.GetType("System.String"));                              //纳入先地址
            exportDt.Columns.Add("ADDRESS2", Type.GetType("System.String"));                             //纳入先地址2
            exportDt.Columns.Add("FANUC_SERIAL_NUMBER", Type.GetType("System.String"));
            exportDt.Columns.Add("FANUC_SLIP_NUMBER", Type.GetType("System.String"));
            #endregion

            //销售订单编号的取得
            #region
            DataTable slipTable = bInvoice.GetSlipNumber(GetOEMProductConduction()).Tables[0];

            string slip_number = "";
            foreach (DataRow row in slipTable.Rows)
            {
                slip_number += "'" + row["ORDER_SLIP_NUMBER"].ToString() + "',";
            }
            slip_number = slip_number.Substring(0, slip_number.Length - 1);
            #endregion

            //根据取出的slipnumber取得第一部分的数据 机械本体的采购信息
            #region
            DataTable oneDt       = bInvoice.GetStatementOneInfo(slip_number).Tables[0];
            DataRow   dr          = null;
            string    machineCode = CConvert.ToString(oneDt.Rows[0]["MACHINE_CODE"]);
            foreach (DataRow row in oneDt.Rows)
            {
                if (machineCode == row["MACHINE_CODE"].ToString())
                {
                    dr = exportDt.NewRow();
                    dr["ORDER_SLIP_NUMBER"] = row["ORDER_SLIP_NUMBER"];
                    dr["MACHINE_CODE"]      = row["MACHINE_CODE"];
                    dr["MACHINE_NAME"]      = row["MACHINE_NAME"];
                    dr["BODY_PURCHASE_ORDER_SLIP_NUMBER"] = row["PURCHASE_ORDER_NUMBER"];
                    dr["BODY_INVOICE_NUMBER_LOCAL"]       = row["INVOICE_NUMBER"];
                    dr["BODY_PURCHASE_SLIP_DATE"]         = row["SLIP_DATE"];
                    dr["FANUC_SERIAL_NUMBER"]             = row["FANUC_SERIAL_NUMBER"];
                    dr["FANUC_SLIP_NUMBER"]   = row["FANUC_SLIP_NUMBER"];
                    dr["BODY_INVOICE_AMOUNT"] = addDecimal(dr["BODY_INVOICE_AMOUNT"], row["INVOICE_AMOUNT"]);
                }
                else
                {
                    exportDt.Rows.Add(dr);
                    dr = exportDt.NewRow();
                    dr["ORDER_SLIP_NUMBER"] = row["ORDER_SLIP_NUMBER"];
                    dr["MACHINE_CODE"]      = row["MACHINE_CODE"];
                    dr["MACHINE_NAME"]      = row["MACHINE_NAME"];
                    dr["BODY_PURCHASE_ORDER_SLIP_NUMBER"] = row["PURCHASE_ORDER_NUMBER"];
                    dr["BODY_INVOICE_NUMBER_LOCAL"]       = row["INVOICE_NUMBER"];
                    dr["BODY_PURCHASE_SLIP_DATE"]         = row["SLIP_DATE"];
                    dr["FANUC_SERIAL_NUMBER"]             = row["FANUC_SERIAL_NUMBER"];
                    dr["FANUC_SLIP_NUMBER"]   = row["FANUC_SLIP_NUMBER"];
                    dr["BODY_INVOICE_AMOUNT"] = row["INVOICE_AMOUNT"];
                    machineCode = row["MACHINE_CODE"].ToString();
                }
            }
            if (dr != null)
            {
                exportDt.Rows.Add(dr);
            }
            #endregion

            //根据取出的ORDER_SLIP_NUMBER取得第二部分的数据  机械部件的采购信息
            #region
            dr = null;
            BExchange bex             = new BExchange();
            DataTable tmpDt           = exportDt.Clone();
            DataTable twoDt           = bInvoice.GetStatementTwoInfo(slip_number).Tables[0];
            string    orderSlipNumber = CConvert.ToString(oneDt.Rows[0]["ORDER_SLIP_NUMBER"]);
            foreach (DataRow row in twoDt.Rows)
            {
                if (orderSlipNumber == row["ORDER_SLIP_NUMBER"].ToString())
                {
                    dr = tmpDt.NewRow();
                    dr["ORDER_SLIP_NUMBER"] = row["ORDER_SLIP_NUMBER"];
                    if (CConvert.ToInt32(row["TYPE"]) == CConstant.ERP_FOREIGN_NUMBER)//国外
                    {
                        dr["FOREIGN_PURCHASE_ORDER_SLIP_NUMBER"] = addString(dr["FOREIGN_PURCHASE_ORDER_SLIP_NUMBER"], row["PURCHASE_ORDER_SLIP_NUMBER"]);
                        dr["FOREIGN_PURCHASE_INVOICE_NUMBER"]    = addString(dr["FOREIGN_PURCHASE_INVOICE_NUMBER"], row["INVOICE_NUMBER"]);
                        dr["FOREIGN_PURCHASE_SLIP_DATE"]         = addString(dr["FOREIGN_PURCHASE_SLIP_DATE"], row["SLIP_DATE"]);
                        dr["FOREIGN_INVOICE_AMOUNT"]             = addDecimal(dr["FOREIGN_INVOICE_AMOUNT"], row["INVOICE_AMOUNT"]);
                        DateTime  datatime      = CConvert.ToDateTime(CConvert.ToDateTime(dr["FOREIGN_INVOICE_AMOUNT"].ToString()).Year + "/" + CConvert.ToDateTime(dr["FOREIGN_INVOICE_AMOUNT"].ToString()).Month + "/1");
                        DataTable ExchangeTable = bex.GetExchangeFromTime(datatime, "", "").Tables[0];
                        dr["EXCHANGE_RATE"]      = ExchangeTable.Rows[0]["EXCHANGE_RATE"].ToString();
                        dr["RMB_INVOICE_AMOUNT"] = addDecimal(dr["RMB_INVOICE_AMOUNT"], CConvert.ToDecimal(row["INVOICE_AMOUNT"]) * CConvert.ToDecimal(dr["EXCHANGE_RATE"]));
                    }
                    else if (CConvert.ToInt32(row["TYPE"]) == CConstant.ERP_DOMESTIC_NUMBER)//国内
                    {
                        dr["PART_PURCHASE_ORDER_SLIP_NUMBER"] = addString(dr["PART_PURCHASE_ORDER_SLIP_NUMBER"], row["PURCHASE_ORDER_SLIP_NUMBER"]);
                        dr["PART_INVOICE_NUMBER_LOCAL"]       = addString(dr["PART_INVOICE_NUMBER_LOCAL"], row["INVOICE_NUMBER"]);
                        dr["PART_PURCHASE_SLIP_DATE"]         = addString(dr["PART_PURCHASE_SLIP_DATE"], row["SLIP_DATE"]);
                        dr["PART_INVOICE_AMOUNT"]             = addDecimal(dr["PART_INVOICE_AMOUNT"], row["INVOICE_AMOUNT"]);
                    }
                    dr["TAX_AMOUNT"] = addDecimal(dr["TAX_AMOUNT"], row["TAX_AMOUNT"]);
                }
                else
                {
                    tmpDt.Rows.Add(dr);
                    orderSlipNumber = row["ORDER_SLIP_NUMBER"].ToString();
                    dr = tmpDt.NewRow();
                    dr["ORDER_SLIP_NUMBER"] = row["ORDER_SLIP_NUMBER"];
                    if (CConvert.ToInt32(row["SUPPLIER_CODE"]) == CConstant.ERP_FOREIGN_NUMBER)//国外
                    {
                        dr["FOREIGN_PURCHASE_ORDER_SLIP_NUMBER"] = addString(dr["FOREIGN_PURCHASE_ORDER_SLIP_NUMBER"], row["PURCHASE_ORDER_SLIP_NUMBER"]);
                        dr["FOREIGN_PURCHASE_INVOICE_NUMBER"]    = addString(dr["FOREIGN_PURCHASE_INVOICE_NUMBER"], row["INVOICE_NUMBER"]);
                        dr["FOREIGN_PURCHASE_SLIP_DATE"]         = addString(dr["FOREIGN_PURCHASE_SLIP_DATE"], row["SLIP_DATE"]);
                        dr["FOREIGN_INVOICE_AMOUNT"]             = addDecimal(dr["FOREIGN_INVOICE_AMOUNT"], row["INVOICE_AMOUNT"]);
                        dr["EXCHANGE_RATE"]      = 0.07;
                        dr["RMB_INVOICE_AMOUNT"] = addDecimal(dr["RMB_INVOICE_AMOUNT"], CConvert.ToDecimal(row["INVOICE_AMOUNT"]) * CConvert.ToDecimal(dr["EXCHANGE_RATE"]));
                    }
                    else if (CConvert.ToInt32(row["SUPPLIER_CODE"]) == CConstant.ERP_DOMESTIC_NUMBER)//国内
                    {
                        dr["PART_PURCHASE_ORDER_SLIP_NUMBER"] = addString(dr["PART_PURCHASE_ORDER_SLIP_NUMBER"], row["PURCHASE_ORDER_SLIP_NUMBER"]);
                        dr["PART_INVOICE_NUMBER_LOCAL"]       = addString(dr["PART_INVOICE_NUMBER_LOCAL"], row["INVOICE_NUMBER"]);
                        dr["PART_PURCHASE_SLIP_DATE"]         = addString(dr["PART_PURCHASE_SLIP_DATE"], row["SLIP_DATE"]);
                        dr["PART_INVOICE_AMOUNT"]             = addDecimal(dr["PART_INVOICE_AMOUNT"], row["INVOICE_AMOUNT"]);
                    }
                    dr["TAX_AMOUNT"] = addDecimal(dr["TAX_AMOUNT"], row["TAX_AMOUNT"]);
                }
            }
            if (dr != null)
            {
                tmpDt.Rows.Add(dr);
            }
            #endregion

            //采购信息段的合并
            #region
            foreach (DataRow row in exportDt.Rows)
            {
                foreach (DataRow tRow in tmpDt.Rows)
                {
                    if (row["ORDER_SLIP_NUMBER"].Equals(tRow["ORDER_SLIP_NUMBER"]))
                    {
                        row["FOREIGN_PURCHASE_ORDER_SLIP_NUMBER"] = tRow["FOREIGN_PURCHASE_ORDER_SLIP_NUMBER"];
                        row["FOREIGN_PURCHASE_INVOICE_NUMBER"]    = tRow["FOREIGN_PURCHASE_INVOICE_NUMBER"];
                        row["FOREIGN_PURCHASE_SLIP_DATE"]         = tRow["FOREIGN_PURCHASE_SLIP_DATE"];
                        row["FOREIGN_INVOICE_AMOUNT"]             = tRow["FOREIGN_INVOICE_AMOUNT"];
                        row["EXCHANGE_RATE"]      = tRow["EXCHANGE_RATE"];
                        row["RMB_INVOICE_AMOUNT"] = tRow["RMB_INVOICE_AMOUNT"];
                        row["PART_PURCHASE_ORDER_SLIP_NUMBER"] = tRow["PART_PURCHASE_ORDER_SLIP_NUMBER"];
                        row["PART_INVOICE_NUMBER_LOCAL"]       = tRow["PART_INVOICE_NUMBER_LOCAL"];
                        row["PART_PURCHASE_SLIP_DATE"]         = tRow["PART_PURCHASE_SLIP_DATE"];
                        row["PART_INVOICE_AMOUNT"]             = tRow["PART_INVOICE_AMOUNT"];
                        row["TAX_AMOUNT"] = tRow["TAX_AMOUNT"];
                    }
                }
            }
            #endregion

            //销售信息的取得
            #region
            DataTable OrderTable = bInvoice.GetOrderHeaderInfo(slip_number).Tables[0];
            foreach (DataRow erow in exportDt.Rows)
            {
                foreach (DataRow Orow in OrderTable.Rows)
                {
                    if (erow["ORDER_SLIP_NUMBER"].Equals(Orow["SLIP_NUMBER"]))
                    {
                        erow["CUSTOMER_PO_NUMBER"]   = Orow["CUSTOMER_PO_NUMBER"];
                        erow["SALES_INVOICE_NUMBER"] = Orow["SERIAL_NUMBER"];
                        erow["ORDER_SLIP_DATE"]      = Orow["SLIP_DATE"];
                        erow["AMOUNT_WITHOUT_TAX"]   = Orow["AMOUNT_WITHOUT_TAX"];
                        erow["CHECK_NUMBER"]         = Orow["CHECK_NUMBER"];
                        erow["CHECK_DATE"]           = Orow["CHECK_DATE"];
                        erow["CUSTOMER_NAME"]        = Orow["CUSTOMER_NAME"];
                        erow["ENDER_CUSTOMER_NAME"]  = Orow["ENDER_CUSTOMER_NAME"];
                        erow["ADDRESS"]  = Orow["DELIVERY_POINT_NAME"];
                        erow["ADDRESS2"] = Orow["DELIVERY_POINT_NAME"];
                    }
                }
            }
            #endregion

            //销售发票信息的取得
            #region
            DataTable InvoiceTable = bInvoice.GetInvoiceNumber(slip_number).Tables[0];
            foreach (DataRow irow in exportDt.Rows)
            {
                foreach (DataRow Irow in InvoiceTable.Rows)
                {
                    if (irow["ORDER_SLIP_NUMBER"].Equals(Irow["ORDER_SLIP_NUMBER"]))
                    {
                        irow["SALES_INVOICE_NUMBER"] = Irow["SALES_INVOICE_NUMBER"];
                        irow["SHIPMENT_SLIP_DATE"]   = Irow["SLIP_DATE"];
                    }
                }
            }
            #endregion

            //机器本体的销售信息的取得
            #region
            DataTable TotalBodyAmount = bInvoice.GetAmountWithoutTaxa(slip_number).Tables[0];
            foreach (DataRow totalrow in exportDt.Rows)
            {
                foreach (DataRow Totalrow in TotalBodyAmount.Rows)
                {
                    if (totalrow["ORDER_SLIP_NUMBER"].Equals(Totalrow["SLIP_NUMBER"]))
                    {
                        totalrow["TOTAL_BODY_AMOUNT"] = Totalrow["AMOUNT_WITHOUT_TAX"];
                    }
                }
            }
            #endregion

            //各种合计金额的计算
            #region
            foreach (DataRow row in exportDt.Rows)
            {
                row["TOTAL"]        = addDecimal(row["RMB_INVOICE_AMOUNT"], row["TAX_AMOUNT"]);
                row["TOTAL_AMOUNT"] = addDecimal(row["BODY_INVOICE_AMOUNT"], row["PART_INVOICE_AMOUNT"], row["TOTAL"]);
            }
            #endregion

            //数据的导出
            #region
            Hashtable      ht = new Hashtable();
            SaveFileDialog sf = new SaveFileDialog();
            sf.FileName = "LZ_PRODUCT_MANAGEMENT_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
            sf.Filter   = "(文件)|*.xls;*.xlsx";
            if (sf.ShowDialog(this) == DialogResult.OK)
            {
                if (exportDt.Rows.Count > 0)
                {
                    int ret = CExport.ExportOEMProduct(@"rpt\OEM_PRODUCT_MANAGEMENT.frx", sf.FileName, exportDt, ht);
                    if (CConstant.EXPORT_FAILURE.Equals(ret))
                    {
                        MessageBox.Show("导出失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else if (CConstant.EXPORT_SUCCESS.Equals(ret))
                    {
                        MessageBox.Show("导出成功。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else if (CConstant.EXPORT_RUNNING.Equals(ret))
                    {
                        MessageBox.Show("文件正在运行,重新生成文件失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else if (CConstant.EXPORT_TEMPLETE_FILE_NOT_EXIST.Equals(ret))
                    {
                        MessageBox.Show("模版文件不存在。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    this.Close();
                }
                else
                {
                    MessageBox.Show("明细信息不存在。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            #endregion
        }
Пример #30
0
        /// <summary>
        /// 应收账款管理表
        /// </summary>
        private void ExportFinanceInfo()
        {
            exportDt = new DataTable();
            exportDt.Columns.Add("SLIP_NUMBER", Type.GetType("System.String"));                 //开票内部订单编号
            exportDt.Columns.Add("SLIP_DATE", Type.GetType("System.String"));                   //开票日期
            exportDt.Columns.Add("SERIAL_NUMBER", Type.GetType("System.String"));               //发票内容
            exportDt.Columns.Add("MODEL_NUMBER", Type.GetType("System.String"));                //机械型号
            exportDt.Columns.Add("CUSTOMER_PO_NUMBER", Type.GetType("System.String"));          //合同编号
            exportDt.Columns.Add("CUSTOMER_NAME", Type.GetType("System.String"));               //代理店
            exportDt.Columns.Add("ENDUSER_CUSTOMER_NAME", Type.GetType("System.String"));       //最终客户
            exportDt.Columns.Add("SHIPMENT_SLIP_DATE", Type.GetType("System.String"));          //出库日期
            exportDt.Columns.Add("QUANTITY", Type.GetType("System.Decimal"));                   //数量
            exportDt.Columns.Add("INVOICE_NUMBER", Type.GetType("System.String"));              //发票No
            exportDt.Columns.Add("INVOICE_AMOUNT_WITHOUT_TAX", Type.GetType("System.Decimal")); //未含税金额
            exportDt.Columns.Add("INVOICE_AMOUNT", Type.GetType("System.Decimal"));             //含税金额
            exportDt.Columns.Add("CUSTOMER_CLAIM_DATE", Type.GetType("System.String"));         //收款预定日期
            exportDt.Columns.Add("RECEIVABLES_DATE_1", Type.GetType("System.String"));          //收款日期1
            exportDt.Columns.Add("RECEIVABLES_1", Type.GetType("System.Decimal"));              //收款金额1
            exportDt.Columns.Add("RECEIVABLES_DATE_2", Type.GetType("System.String"));          //收款日期2
            exportDt.Columns.Add("RECEIVABLES_2", Type.GetType("System.Decimal"));              //收款金额2
            exportDt.Columns.Add("RECEIVABLES_DATE_3", Type.GetType("System.String"));          //收款日期3
            exportDt.Columns.Add("RECEIVABLES_3", Type.GetType("System.Decimal"));              //收款金额3
            exportDt.Columns.Add("UN_RECEIVABLES", Type.GetType("System.Decimal"));             //未收款金额
            exportDt.Columns.Add("TOTAL_RECEIVABLES", Type.GetType("System.Decimal"));          //总收款金额

            DataTable exportMachineDt = exportDt.Clone();
            DataTable exportPartsDt   = exportDt.Clone();
            string    invoiceNumber   = "";
            DataRow   eDr             = null;

            //获得机械本体应收账款
            #region
            DataTable machineDT = bInvoice.GetMachineAccountReceivable(GetConduction()).Tables[0];
            foreach (DataRow dr in machineDT.Rows)
            {
                if (!invoiceNumber.Equals(dr["INVOICE_NUMBER"]))
                {
                    if (invoiceNumber != "")
                    {
                        exportMachineDt.Rows.Add(eDr);
                    }
                    eDr = exportMachineDt.NewRow();
                    eDr["SLIP_NUMBER"]           = dr["SLIP_NUMBER"];                                              //开票内部订单编号
                    eDr["SLIP_DATE"]             = dr["SLIP_DATE"];                                                //开票日期
                    eDr["SERIAL_NUMBER"]         = dr["SERIAL_NUMBER"];                                            //发票内容
                    eDr["MODEL_NUMBER"]          = dr["MODEL_NUMBER"];                                             //机械型号
                    eDr["CUSTOMER_PO_NUMBER"]    = dr["CUSTOMER_PO_NUMBER"];                                       //合同编号
                    eDr["CUSTOMER_NAME"]         = dr["CUSTOMER_NAME"];                                            //代理店
                    eDr["ENDUSER_CUSTOMER_NAME"] = dr["ENDUSER_CUSTOMER_NAME"];                                    //最终客户
                    eDr["SHIPMENT_SLIP_DATE"]    = dr["SHIPMENT_SLIP_DATE"];                                       //出库日期
                    eDr["QUANTITY"]                   = 1;                                                         //dr["QUANTITY"]; //数量
                    eDr["INVOICE_NUMBER"]             = dr["INVOICE_NUMBER"];                                      //发票No
                    eDr["INVOICE_AMOUNT_WITHOUT_TAX"] = GetAmountWithoutTax(dr["INVOICE_AMOUNT"], dr["TAX_RATE"]); //未含税金额
                    eDr["INVOICE_AMOUNT"]             = dr["INVOICE_AMOUNT"];                                      //含税金额
                    eDr["CUSTOMER_CLAIM_DATE"]        = dr["CUSTOMER_CLAIM_DATE"];                                 //收款预定日期
                    invoiceNumber = CConvert.ToString(dr["INVOICE_NUMBER"]);
                }
            }
            if (eDr != null)
            {
                exportMachineDt.Rows.Add(eDr);
            }
            #endregion

            //获得机械部件应收账款
            #region
            DataTable partsDT = bInvoice.GetPartsAccountReceivable(GetConduction()).Tables[0];
            invoiceNumber = "";
            eDr           = null;
            foreach (DataRow dr in partsDT.Rows)
            {
                if (!invoiceNumber.Equals(dr["INVOICE_NUMBER"]))
                {
                    if (invoiceNumber != "")
                    {
                        exportPartsDt.Rows.Add(eDr);
                    }
                    eDr = exportPartsDt.NewRow();
                    eDr["SLIP_NUMBER"]           = dr["SLIP_NUMBER"];                                              //开票内部订单编号
                    eDr["SLIP_DATE"]             = dr["SLIP_DATE"];                                                //开票日期
                    eDr["SERIAL_NUMBER"]         = dr["SERIAL_NUMBER"];                                            //发票内容
                    eDr["MODEL_NUMBER"]          = "";                                                             //dr["MODEL_NUMBER"];  //机械型号
                    eDr["CUSTOMER_PO_NUMBER"]    = dr["CUSTOMER_PO_NUMBER"];                                       //合同编号
                    eDr["CUSTOMER_NAME"]         = dr["CUSTOMER_NAME"];                                            //代理店
                    eDr["ENDUSER_CUSTOMER_NAME"] = dr["ENDUSER_CUSTOMER_NAME"];                                    //最终客户
                    eDr["SHIPMENT_SLIP_DATE"]    = dr["SHIPMENT_SLIP_DATE"];                                       //出库日期
                    eDr["QUANTITY"]                   = 1;                                                         //dr["QUANTITY"]; //数量
                    eDr["INVOICE_NUMBER"]             = dr["INVOICE_NUMBER"];                                      //发票No
                    eDr["INVOICE_AMOUNT_WITHOUT_TAX"] = GetAmountWithoutTax(dr["INVOICE_AMOUNT"], dr["TAX_RATE"]); //未含税金额
                    eDr["INVOICE_AMOUNT"]             = dr["INVOICE_AMOUNT"];                                      //含税金额
                    eDr["CUSTOMER_CLAIM_DATE"]        = dr["CUSTOMER_CLAIM_DATE"];                                 //收款预定日期
                    invoiceNumber = CConvert.ToString(dr["INVOICE_NUMBER"]);
                }
            }
            if (eDr != null)
            {
                exportPartsDt.Rows.Add(eDr);
            }
            #endregion

            decimal totalAmount                  = 0;
            decimal machineTotalAmount           = 0;
            decimal machineTotalAmountWithoutTax = 0;
            decimal partTotalAmountWithoutTax    = 0;
            //付款信息的实装
            #region
            //获得开票付款信息
            DataTable receiptDT = bInvoice.GetReceiptMatch(GetReceiptMatchConduction()).Tables[0];

            //机械本体的开票信息的实装
            foreach (DataRow dr in exportMachineDt.Rows)
            {
                int i = 1;
                foreach (DataRow rDr in receiptDT.Rows)
                {
                    if (CConvert.ToString(dr["SLIP_NUMBER"]).Equals(rDr["SLIP_NUMBER"]))
                    {
                        dr["RECEIVABLES_DATE_" + i] = rDr["SLIP_DATE"];
                        dr["RECEIVABLES_" + i]      = rDr["RECEIPT_AMOUNT"];
                        i++;
                        if (i > 3)
                        {
                            break;
                        }
                    }
                }
                dr["TOTAL_RECEIVABLES"] = addDecimal(dr["RECEIVABLES_1"], dr["RECEIVABLES_2"], dr["RECEIVABLES_3"]);
                dr["UN_RECEIVABLES"]    = CConvert.ToDecimal(dr["INVOICE_AMOUNT"]) - CConvert.ToDecimal(dr["TOTAL_RECEIVABLES"]);

                machineTotalAmountWithoutTax += CConvert.ToDecimal(dr["INVOICE_AMOUNT_WITHOUT_TAX"]);
                machineTotalAmount           += CConvert.ToDecimal(dr["INVOICE_AMOUNT"]);
                totalAmount += machineTotalAmount;
            }

            //机械部件的开票信息的实装
            foreach (DataRow dr in exportPartsDt.Rows)
            {
                int i = 1;
                foreach (DataRow rDr in receiptDT.Rows)
                {
                    if (CConvert.ToString(dr["SLIP_NUMBER"]).Equals(rDr["SLIP_NUMBER"]))
                    {
                        dr["RECEIVABLES_DATE_" + i] = rDr["SLIP_DATE"];
                        dr["RECEIVABLES_" + i]      = rDr["RECEIPT_AMOUNT"];
                        i++;
                        if (i > 3)
                        {
                            break;
                        }
                    }
                }
                dr["TOTAL_RECEIVABLES"] = addDecimal(dr["RECEIVABLES_1"], dr["RECEIVABLES_2"], dr["RECEIVABLES_3"]);
                dr["UN_RECEIVABLES"]    = CConvert.ToDecimal(dr["INVOICE_AMOUNT"]) - CConvert.ToDecimal(dr["TOTAL_RECEIVABLES"]);

                partTotalAmountWithoutTax += CConvert.ToDecimal(dr["INVOICE_AMOUNT_WITHOUT_TAX"]);
                totalAmount += CConvert.ToDecimal(dr["INVOICE_AMOUNT"]);;
            }
            #endregion


            //数据的导出
            string[] headerTitles = { "发票内部编号", "発行年月", "発票内容", "機械型番", "契約書No.", "商社名", "顧客名", "出荷日", "台数", "発票No.", "金額(税抜)(元)", "金額(税込)(元)", "入金予定日", "入金日1", "入金額(元)1", "入金日2", "入金額(元)2", "入金日3", "入金額(元)3", "未入金額(元)", "入金総額(元)" };
            #region
            Hashtable ht = new Hashtable();
            ht.Add("&DATE", dateFrom.Text + (dateTo.Checked == true ? " 至 " + dateTo.Text : ""));
            ht.Add("&TOTAL_AMOUNT", totalAmount);
            ht.Add("&MACHINE_TOTAL_AMOUNT", machineTotalAmount);
            ht.Add("&B_MACHINE_TOTAL_AMOUNT_WITHOUT_TAX", machineTotalAmountWithoutTax);
            ht.Add("&PART_TOTAL_AMOUNT_WITHOUT_TAX", partTotalAmountWithoutTax);
            SaveFileDialog sf = new SaveFileDialog();
            sf.FileName = "LZ_RECEIVABLES_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
            sf.Filter   = "(文件)|*.xls;*.xlsx";
            if (sf.ShowDialog(this) == DialogResult.OK)
            {
                if (exportMachineDt.Rows.Count > 0 || exportPartsDt.Rows.Count > 0)
                {
                    int ret = CExport.ExportReceivables(@"rpt\Receivables.frx", sf.FileName, exportMachineDt, exportPartsDt, ht, headerTitles);
                    if (CConstant.EXPORT_FAILURE.Equals(ret))
                    {
                        MessageBox.Show("导出失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else if (CConstant.EXPORT_SUCCESS.Equals(ret))
                    {
                        MessageBox.Show("导出成功。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else if (CConstant.EXPORT_RUNNING.Equals(ret))
                    {
                        MessageBox.Show("文件正在运行,重新生成文件失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else if (CConstant.EXPORT_TEMPLETE_FILE_NOT_EXIST.Equals(ret))
                    {
                        MessageBox.Show("模版文件不存在。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    this.Close();
                }
                else
                {
                    MessageBox.Show("明细信息不存在。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            #endregion
        }