Example #1
0
 public PrintForm(List <InvTypeEntity> _InvTypeList, List <ItemEntity> _ItemsList, QueryPrintEntity _queryPrintEntity)
 {
     this.InitializeComponent();
     this.m_InvTypeList      = _InvTypeList;
     this.m_ItemsList        = _ItemsList;
     this.m_QueryPrintEntity = _queryPrintEntity;
 }
Example #2
0
 public InvoiceResultForm(QueryPrintEntity _queryPrintEntity)
 {
     this.Initial();
     ControlStyleUtil.SetToolStripStyle(this.toolStripMenu);
     this.toolStripButtonExit.Margin     = new Padding(20, 1, 0, 2);
     this.m_queryPrintEntity             = _queryPrintEntity;
     this.customStyleDataGridDetail.Dock = DockStyle.Fill;
     this.customStyleDataGridDetail.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
     this.customStyleDataGridDetail.set_ColumnHeadersHeightSizeMode(DataGridViewColumnHeadersHeightSizeMode.AutoSize);
     this.m_queryPrintBLL.MakeTable(ref this.customStyleDataGridDetail, _queryPrintEntity);
 }
Example #3
0
        public bool MakeTable(ref CustomStyleDataGrid dataGridView, QueryPrintEntity queryPrintEntity)
        {
            DateTime time2;
            DateTime dtStart = Convert.ToDateTime(queryPrintEntity.m_nYear.ToString() + "-" + queryPrintEntity.m_nMonth.ToString() + "-01");

            if (queryPrintEntity.m_nMonth == 12)
            {
                time2 = Convert.ToDateTime(((queryPrintEntity.m_nYear + 1)).ToString() + "-01-01");
            }
            else
            {
                time2 = Convert.ToDateTime(queryPrintEntity.m_nYear.ToString() + "-" + ((queryPrintEntity.m_nMonth + 1)).ToString() + "-01");
            }
            dataGridView.ReadOnly = true;
            string strType = "";
            bool   bWaste  = false;

            if (queryPrintEntity.m_invType == INV_TYPE.INV_COMMON)
            {
                strType = "c";
            }
            else if (queryPrintEntity.m_invType == INV_TYPE.INV_SPECIAL)
            {
                strType = "s";
            }
            else if (queryPrintEntity.m_invType == INV_TYPE.INV_TRANSPORTATION)
            {
                strType = "f";
            }
            else if (queryPrintEntity.m_invType == INV_TYPE.INV_VEHICLESALES)
            {
                strType = "j";
            }
            else if (queryPrintEntity.m_invType == INV_TYPE.INV_PTDZ)
            {
                strType = "p";
            }
            else if (queryPrintEntity.m_invType == INV_TYPE.INV_JSFP)
            {
                strType = "q";
            }
            if ((queryPrintEntity.m_itemAction == ITEM_ACTION.ITEM_PLUS) || (queryPrintEntity.m_itemAction == ITEM_ACTION.ITEM_MINUS))
            {
                bWaste = false;
                if (queryPrintEntity.m_itemAction == ITEM_ACTION.ITEM_PLUS)
                {
                    this.dataTable = this.queryPrintDAL.GetPlusTable(strType, bWaste, dtStart, time2, queryPrintEntity.m_nTaxPeriod);
                }
                else
                {
                    this.dataTable = this.queryPrintDAL.GetMinusTable(strType, bWaste, dtStart, time2, queryPrintEntity.m_nTaxPeriod);
                }
            }
            else
            {
                bWaste = true;
                if (queryPrintEntity.m_itemAction == ITEM_ACTION.ITEM_PLUS_WASTE)
                {
                    this.dataTable = this.queryPrintDAL.GetPlusTable(strType, bWaste, dtStart, time2, queryPrintEntity.m_nTaxPeriod);
                }
                else
                {
                    this.dataTable = this.queryPrintDAL.GetMinusTable(strType, bWaste, dtStart, time2, queryPrintEntity.m_nTaxPeriod);
                }
            }
            this.dataTable.Columns.Add("税率1", Type.GetType("System.String"));
            for (int i = 0; i < this.dataTable.Rows.Count; i++)
            {
                string str2 = this.dataTable.Rows[i]["发票种类"].ToString();
                string str3 = this.dataTable.Rows[i]["税率"].ToString();
                if (string.IsNullOrEmpty(str3))
                {
                    this.dataTable.Rows[i]["税率1"] = "多税率";
                }
                else if (str3.Equals("0"))
                {
                    this.dataTable.Rows[i]["税率1"] = "0%";
                }
                else if (str3.Equals("0.05") && str2.Equals("s"))
                {
                    this.dataTable.Rows[i]["税率1"] = "5%";
                }
                else
                {
                    str3 = string.Format("{0}%", float.Parse(str3) * 100f);
                    this.dataTable.Rows[i]["税率1"] = str3;
                }
                this.dataTable.Rows[i]["开票日期"] = ((DateTime)this.dataTable.Rows[i]["开票日期"]).ToShortDateString();
                this.dataTable.Rows[i]["合计金额"].GetType();
                this.dataTable.Rows[i]["合计金额"] = Convert.ToDecimal(this.dataTable.Rows[i]["合计金额"]).ToString("F2");
                this.dataTable.Rows[i]["合计税额"] = Convert.ToDecimal(this.dataTable.Rows[i]["合计税额"]).ToString("F2");
                int    num4 = Convert.ToInt32(this.dataTable.Rows[i]["发票号码"]);
                string str4 = string.Format("{0:00000000}", num4);
                this.dataTable.Rows[i]["发票号码"] = str4;
            }
            this.dataTable.Columns.Remove("税率");
            this.dataTable.Columns["税率1"].ColumnName = "税率";
            if (this.dataTable == null)
            {
                this.dataTable = new DataTable();
                this.dataTable.Columns.Add("发票种类");
                this.dataTable.Columns.Add("类别代码");
                this.dataTable.Columns.Add("发票号码");
                this.dataTable.Columns.Add("开票日期");
                this.dataTable.Columns.Add("购方税号");
                this.dataTable.Columns.Add("合计金额");
                this.dataTable.Columns.Add("合计税额");
                this.dataTable.Columns.Add("税率");
                dataGridView.DataSource = this.dataTable;
                if (dataGridView.Columns["营业税标志"] != null)
                {
                    dataGridView.Columns["营业税标志"].Visible = false;
                }
                return(false);
            }
            if (this.dataTable.Rows.Count > 0)
            {
                dataGridView.AllowUserToAddRows = false;
            }
            dataGridView.DataSource = this.dataTable;
            if (dataGridView.Columns["营业税标志"] != null)
            {
                dataGridView.Columns["营业税标志"].Visible = false;
            }
            for (int j = 0; j < dataGridView.Columns.Count; j++)
            {
                dataGridView.Columns[j].SortMode = DataGridViewColumnSortMode.NotSortable;
            }
            for (int k = 0; k < this.dataTable.Rows.Count; k++)
            {
                if (queryPrintEntity.m_invType == INV_TYPE.INV_COMMON)
                {
                    dataGridView["发票种类", k].Value = "普通发票";
                }
                else if (queryPrintEntity.m_invType == INV_TYPE.INV_SPECIAL)
                {
                    dataGridView["发票种类", k].Value = "专用发票";
                }
                else if (queryPrintEntity.m_invType == INV_TYPE.INV_TRANSPORTATION)
                {
                    dataGridView["发票种类", k].Value = "货物运输业增值税专用发票";
                }
                else if (queryPrintEntity.m_invType == INV_TYPE.INV_VEHICLESALES)
                {
                    dataGridView["发票种类", k].Value = "机动车销售统一发票";
                }
                else if (queryPrintEntity.m_invType == INV_TYPE.INV_PTDZ)
                {
                    dataGridView["发票种类", k].Value = "电子增值税普通发票";
                }
                else if (queryPrintEntity.m_invType == INV_TYPE.INV_JSFP)
                {
                    dataGridView["发票种类", k].Value = "增值税普通发票(卷票)";
                }
            }
            return(true);
        }