コード例 #1
0
    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        Label1.Text = "";
        int                     index        = GridView1.SelectedIndex;
        GridViewRow             grv          = GridView1.SelectedRow;
        string                  sale_bill_no = (grv.Cells[1].Controls[0] as HyperLink).Text;
        ProfitAccountingAdapter paa          = new ProfitAccountingAdapter();
        DataSet                 ds           = paa.getActualProfit(sale_bill_no);

        if (ds.Tables[0].Rows.Count > 0)
        {
            DataRow dr = ds.Tables[0].Rows[0];
            txt_sale_bill_no.Text = sale_bill_no;
            decimal actual_amount = Decimal.Parse(dr["actual_amount"].ToString());
            txt_actual_amount.Text = actual_amount.ToString("f2");
            decimal commission = decimal.Parse(dr["commission"].ToString());
            txt_commission.Text = commission.ToString("f3");
            decimal extra_charges = decimal.Parse(dr["extra_charges"].ToString());
            txt_extra_charges.Text = extra_charges.ToString("f2");
            decimal actual_pay = decimal.Parse(dr["actual_pay"].ToString());
            txt_actual_pay.Text = actual_pay.ToString("f2");
            //退税
            TaxListAdapter tla        = new TaxListAdapter();
            decimal        return_tax = tla.getTaxReturnTotal(sale_bill_no);
            txt_return_tax.Text = return_tax.ToString("f2");
            decimal actual_profit_amount = actual_amount - actual_pay;
            lbl_actual_profit_amount.Text = (actual_profit_amount - extra_charges - commission + return_tax).ToString("f2");

            decimal actual_profit = (actual_profit_amount - extra_charges - commission + return_tax) / actual_amount;
            lbl_actual_profit.Text = actual_profit.ToString("f3");

            save.Enabled = true;
        }
    }
コード例 #2
0
    private void show()
    {
        string         entryId      = txt_entryId.Text.Trim();
        string         sale_bill_no = txt_sale_bill_no.Text.Trim();
        TaxListAdapter tla          = new TaxListAdapter();

        GridView1.DataSource = tla.getTaxListByKeys(entryId, sale_bill_no);
        GridView1.DataBind();
    }
コード例 #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         ddlDataBind();
         TaxListAdapter tla = new TaxListAdapter();
         show(tla.getTaxList());
     }
 }
コード例 #4
0
    private void getQueryData()
    {
        T_TaxList item = new T_TaxList();

        if (!string.IsNullOrEmpty(txt_owner_name.Text.Trim()))
        {
            item.OwnerName = txt_owner_name.Text.Trim();
        }
        if (!string.IsNullOrEmpty(txt_entry_id.Text.Trim()))
        {
            item.EntryId = txt_entry_id.Text.Trim();
        }
        if (!string.IsNullOrEmpty(txt_sale_bill_no.Text.Trim()))
        {
            item.SaleBillNo = txt_sale_bill_no.Text.Trim();
        }
        if (!string.IsNullOrEmpty(txt_g_name.Text.Trim()))
        {
            item.GName = txt_g_name.Text.Trim();
        }
        if (!string.IsNullOrEmpty(txt_code_ts.Text.Trim()))
        {
            item.CodeTs = txt_code_ts.Text.Trim();
        }
        if (!string.IsNullOrEmpty(DropDownList1.SelectedValue))
        {
            item.StateCode = DropDownList1.SelectedValue;
        }
        if (!string.IsNullOrEmpty(CalendarBox1.Text.Trim()))
        {
            item.startTime = DateTime.Parse(CalendarBox1.Text.Trim());
        }
        if (!string.IsNullOrEmpty(CalendarBox2.Text.Trim()))
        {
            item.endTime = DateTime.Parse(CalendarBox2.Text.Trim());
        }

        TaxListAdapter tla = new TaxListAdapter();

        show(tla.queryTaxList(item));
    }
コード例 #5
0
    /// <summary>
    /// 保存并导出excel
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Button1_Click(object sender, EventArgs e)
    {
        Label1.Text    = "";
        Label1.Visible = false;
        //合同表头
        T_ContractHead contractHead = new T_ContractHead();

        //需方信息

        contractHead.Xufang                 = TextBox12.Text.Trim();
        contractHead.XufangAddress          = TextBox4.Text.Trim();
        contractHead.XufangJingbanren       = TextBox3.Text.Trim();
        contractHead.XufangTel              = TextBox2.Text.Trim();
        contractHead.XufangFadingdaibiaoren = TextBox8.Text.Trim();
        contractHead.XufangDailiren         = TextBox10.Text.Trim();
        if (!string.IsNullOrEmpty(CalendarBox1.Text.Trim()))
        {
            contractHead.XufangQianziDate = DateTime.Parse(CalendarBox1.Text.Trim());
        }

        //供方信息
        contractHead.Gongfang                 = ddlGongFang.SelectedItem.Text;
        contractHead.GongfangTel              = TextBox6.Text.Trim();
        contractHead.GongfangJingbanren       = TextBox5.Text.Trim();
        contractHead.GongfangDailiren         = TextBox11.Text.Trim();
        contractHead.GongfangFadingdaibiaoren = TextBox9.Text.Trim();
        if (!string.IsNullOrEmpty(CalendarBox2.Text.Trim()))
        {
            contractHead.GongfangQianziDate = DateTime.Parse(CalendarBox2.Text.Trim());
        }

        //合同其他信息
        if (string.IsNullOrEmpty(TextBox1.Text.Trim()))
        {
            return;
        }
        contractHead.ContractId = TextBox1.Text.Trim();

        TextBox tb = (TextBox)GridView1.Rows[0].Cells[0].FindControl("txt_delivery_date");

        if (!string.IsNullOrEmpty(tb.Text.Trim()))
        {
            contractHead.DeliveryDate = DateTime.Parse(tb.Text.Trim());
        }

        Label inner_lb_all = GridView1.Rows[GridView1.Rows.Count - 1].Cells[5].FindControl("txt_invoice_total") as Label;

        if (!string.IsNullOrEmpty(inner_lb_all.Text.Trim()))
        {
            contractHead.InvoiceAll = decimal.Parse(inner_lb_all.Text.Trim());
        }
        else
        {
            contractHead.InvoiceAll = Decimal.Zero;
        }
        if (!string.IsNullOrEmpty(TextBox7.Text.Trim()))
        {
            contractHead.PaymentDays = Int32.Parse(TextBox7.Text.Trim());
        }
        contractHead.DeliveryMode = DropDownList1.SelectedValue;


        //合同表体
        List <T_ContractList> contract_lists = new List <T_ContractList>();

        for (int i = 0; i < GridView1.Rows.Count - 1; i++)
        {
            T_ContractList list = new T_ContractList();
            list.ContractId = contractHead.ContractId;
            list.ContractNo = i + 1;
            HiddenField hdf1 = GridView1.Rows[i].Cells[0].FindControl("hdf_entry_id") as HiddenField;
            list.EntryId = hdf1.Value;
            HiddenField hdf2 = GridView1.Rows[i].Cells[0].FindControl("hdf_g_no") as HiddenField;
            HiddenField hdf3 = GridView1.Rows[i].Cells[0].FindControl("hnf_sale_bill_no") as HiddenField;
            list.SaleBillNo = hdf3.Value.Trim();
            list.GNo        = Int32.Parse(hdf2.Value.Trim());
            list.GName      = GridView1.Rows[i].Cells[1].Text;
            list.GQty       = decimal.Parse(GridView1.Rows[i].Cells[2].Text.Trim());
            list.GUnit      = GridView1.Rows[i].Cells[3].Text;
            TextBox tb1 = GridView1.Rows[i].Cells[4].FindControl("txt_invoice_price") as TextBox;
            if (!string.IsNullOrEmpty(tb1.Text.Trim()))
            {
                list.InvoicePrice = decimal.Parse(tb1.Text.Trim());
            }
            else
            {
                list.InvoicePrice = decimal.Zero;
            }
            Label lb1 = GridView1.Rows[i].Cells[5].FindControl("txt_invoice_total") as Label;
            if (!string.IsNullOrEmpty(lb1.Text.Trim()))
            {
                list.InvoiceTotal = decimal.Parse(lb1.Text.Trim());
            }
            else
            {
                list.InvoiceTotal = decimal.Zero;
            }
            contract_lists.Add(list);
        }


        try
        {
            ContractAdapter ca = new ContractAdapter();
            EntryAdapter    ea = new EntryAdapter();
            TaxListAdapter  ta = new TaxListAdapter();
            ca.addContractHead(contractHead);
            ca.addContractList(contract_lists);
            //生成tax_list记录
            decimal bilu = decimal.Parse(ConfigurationManager.AppSettings["bilv"].ToString());
            ta.generateTaxList(bilu);
            //更新entry_list的invoice_flag标志位为Ture
            ea.invoice(contract_lists);
        }
        catch (Exception ex)
        {
            Label1.Text    = ex.Message;
            Label1.Visible = true;
            return;
        }


        string filename;
        string server_file_path;

        bool result = DataTableToExcel(contractHead, contract_lists, out filename, out server_file_path);

        if (result)
        {
            //开始下载
            BigFileDownload(filename, server_file_path);
        }
        else
        {
            Response.Write("导出数据失败");
        }
        //Page.ClientScript.RegisterStartupScript(this.GetType(), "", " <script lanuage=javascript>alert('开票成功!');window.opener=null;window.top.open('','_self','');window.top.close(this);</script>");
    }
コード例 #6
0
    protected void updateUser_Click(object sender, EventArgs e)
    {
        T_TaxList taxlist = new T_TaxList();

        if (!changed)
        {
            GetSelectedItem();
        }
        string[] ids = this.SelectedItems.ToArray();
        if (ids.Length == 0)
        {
            Label1.Text = "请先至少选择一行数据!";
            return;
        }
        string state = DropDownList1.SelectedValue;

        taxlist.StateCode = state;
        switch (state)
        {
        case "D":
            if (string.IsNullOrEmpty(CalendarBox1.Text))
            {
                Label1.Text = "退税申报日期不能为空";
                return;
            }
            else
            {
                taxlist.TaxRetutnDDate = DateTime.Parse(CalendarBox1.Text);
            }
            if (string.IsNullOrEmpty(txt_tax_return_no.Text))
            {
                Label1.Text = "申报批次号不能为空";
                return;
            }
            else
            {
                taxlist.TaxReturnNo = txt_tax_return_no.Text;
            }
            if (string.IsNullOrEmpty(CalendarBox2.Text))
            {
                Label1.Text = "退税日期不能为空";
                return;
            }
            else
            {
                taxlist.TaxReturnDate = DateTime.Parse(CalendarBox2.Text);
            }
            break;

        default:
            taxlist.TaxReturnDate  = null;
            taxlist.TaxReturnNo    = "";
            taxlist.TaxRetutnDDate = null;
            break;
        }

        TaxListAdapter tla = new TaxListAdapter();

        try
        {
            tla.UpdateState(taxlist, ids);
            Label1.Text = "更新成功";
            init();
            show();
        }
        catch (Exception ex)
        {
            Label1.Text = ex.Message;
        }
    }