You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
636 lines
25 KiB
636 lines
25 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using CK.SCP.Common;
|
|
using CK.SCP.Controller;
|
|
using CK.SCP.Models.Enums;
|
|
using CK.SCP.Models.ScpEntity;
|
|
using CK.SCP.Utils;
|
|
using FineUI;
|
|
using System.Drawing;
|
|
|
|
namespace SCP.Views.SupplierData
|
|
{
|
|
public partial class SCP_INVOICE_EDIT : PageBase
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
IsRoleRight();
|
|
|
|
if (!IsPostBack)
|
|
{
|
|
TranslatorAgents(Toolbar2);
|
|
TranslatorAgent(Grid1);
|
|
TranslatorAgents(FormRow_1);
|
|
TranslatorAgents(FormRow_2);
|
|
TranslatorAgents(FormRow_3);
|
|
TranslatorAgents(FormRow_4);
|
|
BindData();
|
|
GetInvoice();
|
|
SetRoleRule();
|
|
|
|
}
|
|
}
|
|
|
|
public void IsRoleRight()
|
|
{
|
|
//if (!CurrentUser.RoleList.Contains("供应商"))
|
|
//{
|
|
// Alert.Show("当前用户角色不能操作该模块!");
|
|
// return;
|
|
//}
|
|
//if (CurrentUser.VenderList == null || CurrentUser.VenderList.Count == 0)
|
|
//{
|
|
// Alert.Show("当前用户未选择地点!");
|
|
// return;
|
|
//}
|
|
}
|
|
|
|
private void SetRoleRule()
|
|
{
|
|
//IsPriceVisible(Grid1, "合同价格");
|
|
//IsPriceVisible(Grid1, "合同差额");
|
|
IsPriceVisible(Grid1, "要货日期");
|
|
}
|
|
|
|
public decimal ToDecimal(decimal num, int scale)
|
|
{
|
|
decimal tempOdds = Math.Round(num, scale);
|
|
//if (tempOdds > num)
|
|
//{
|
|
// num = (decimal)((double)(tempOdds - (decimal)Math.Pow(10, -scale)));
|
|
//}
|
|
//else
|
|
//{
|
|
// num = (decimal)((double)tempOdds);
|
|
//}
|
|
//return num;
|
|
return tempOdds;
|
|
}
|
|
|
|
private void Search(Action<IQueryable<V_TB_INVOICE_DETAIL>> p_list)
|
|
{
|
|
|
|
string id = GetQueryValue("ID");
|
|
V_TB_INVOICE_DETAIL _tb = new V_TB_INVOICE_DETAIL();
|
|
_tb.InvcBillNum = id;
|
|
SCP_INVOICE_CONTROLLER.Get_V_TB_INVOICE_DETAIL_List(_tb, (ret) =>
|
|
{
|
|
if (ret.State == ReturnStatus.Succeed)
|
|
{
|
|
p_list(ret.Result);
|
|
}
|
|
|
|
});
|
|
}
|
|
|
|
public void BindData()
|
|
{
|
|
Search(ret =>
|
|
{
|
|
Grid1.RecordCount = ret.Count();
|
|
var list = SortAndPage(ret, Grid1);
|
|
//Grid1.DataSource =SCP_RECIVECE_CONTROLLER.Get_V_TB_INVOICE_LIST(list.ToList());
|
|
List<V_TB_INVOICE_DETAIL> temp = SCP_RECIVECE_CONTROLLER.Get_V_TB_INVOICE_LIST(list.ToList());
|
|
//temp = SCP_CONTRACT_CONTROLLER.GET_CONTRACT_PRICE_LIST(temp);
|
|
|
|
//decimal htjgSum = 0;//合同总价
|
|
//decimal htceSum = 0;//合同差额
|
|
//foreach (V_TB_INVOICE_DETAIL rec in temp)
|
|
//{
|
|
// rec.Qty = ToDecimal(rec.Qty, 2);
|
|
// rec.CanQty = ToDecimal(rec.CanQty, 2);
|
|
|
|
// htjgSum += rec.Qty * (rec.ContractPrice == null ? 0 : Convert.ToDecimal(rec.ContractPrice));//开票数量*合同价格
|
|
// htceSum += rec.Qty * (rec.BlancePrice == null ? 0 : Convert.ToDecimal(rec.BlancePrice));//开票数量*合同差额
|
|
//}
|
|
|
|
//txtContractPrice1.Text = htjgSum.ToString();
|
|
//txtBlancePrice1.Text = htceSum.ToString();
|
|
GetInvoice();
|
|
Grid1.DataSource = temp;
|
|
Grid1.DataBind();
|
|
});
|
|
|
|
|
|
}
|
|
|
|
private void GetInvoice()
|
|
{
|
|
string id = GetQueryValue("ID");
|
|
string vendid = "";
|
|
if (CurrentUser.VenderList != null && CurrentUser.VenderList.Count > 0)
|
|
{
|
|
if (CurrentUser.RoleList.Contains("采购人员"))
|
|
{
|
|
vendid = GetQueryValue("VendId");
|
|
}
|
|
else
|
|
{
|
|
vendid = CurrentUser.VenderList[0];
|
|
}
|
|
}
|
|
|
|
SCP_INVOICE_CONTROLLER.Get_V_TB_INVOICE_List(new V_TB_INVOICE { InvcBillNum = id, VendId = vendid }, (ret) =>
|
|
{
|
|
|
|
if (ret.State == ReturnStatus.Succeed)
|
|
{
|
|
var _ls = ret.Result.ToList();
|
|
if (_ls != null && _ls.Count > 0)
|
|
{
|
|
var _Model = _ls[0];
|
|
Session["Invoice"] = _Model;
|
|
txtState.Text = _Model.State_DESC;
|
|
txtBillNo.Text = _Model.InvcBillNum;
|
|
txtBillTime.Text = Convert.ToDateTime(_Model.CreateTime).ToString("yyyy-MM-dd");
|
|
txtSupplierName.Text = _Model.VendName;
|
|
txtInvoiceNumber.Text = _Model.InvoiceNum;
|
|
txtExpressNumber.Text = _Model.ExpressNum;
|
|
|
|
txtTax.Text = _Model.Tax != null ? _Model.Tax.Value.ToString() : "0";
|
|
txtTaxAmount.Text = _Model.TaxAmount!=null?_Model.TaxAmount.Value.ToString():"0";
|
|
|
|
//if (_Model.State != (int)InvoiceState.New)
|
|
//{
|
|
txtContractPrice1.Text = _Model.ContractPrice != null ? _Model.ContractPrice.ToString() : string.Empty;
|
|
txtBlancePrice1.Text = _Model.BlancePrice != null ? _Model.BlancePrice.ToString() : string.Empty;
|
|
//}
|
|
txtAmount.Text = _Model.Amount.ToString();
|
|
txtTotal.Text = _Model.Total != null ? _Model.Total.ToString() : string.Empty;
|
|
txtMoldSharingPrice.Text = _Model.MoldSharingPrice.ToString();
|
|
txtMemo.Text = _Model.Remark;
|
|
if (_Model.State == (int)InvoiceState.New || _Model.State == (int)InvoiceState.CheckFail)
|
|
{
|
|
string la = GetCurrentLanguage();
|
|
if (la == "CH")
|
|
{
|
|
this.btnOK.Hidden = false;
|
|
this.btnOK_1.Hidden = true;
|
|
this.btnApply.Hidden = false;
|
|
this.btnApply_1.Hidden = true;
|
|
this.btnReject.Hidden = false;
|
|
this.btnReject_1.Hidden = true;
|
|
}
|
|
else
|
|
{
|
|
this.btnApply.Hidden = true;
|
|
this.btnApply_1.Hidden = false;
|
|
this.btnOK.Hidden = true;
|
|
this.btnOK_1.Hidden = false;
|
|
this.btnReject.Hidden = true;
|
|
this.btnReject_1.Hidden = false;
|
|
}
|
|
//this.btnOK.Hidden = false;
|
|
//this.btnApply.Hidden = false;
|
|
//this.btnReject.Hidden = false;
|
|
}
|
|
|
|
if (_Model.State == (int)InvoiceState.Reject)
|
|
{
|
|
this.btnReject.Hidden = true;
|
|
this.btnReject_1.Hidden = true;
|
|
}
|
|
|
|
//提交之后不能作废
|
|
if (_Model.State == (int)InvoiceState.New)
|
|
{
|
|
string la = GetCurrentLanguage();
|
|
if (la == "CH")
|
|
{
|
|
this.btnReject.Hidden = false;
|
|
this.btnReject_1.Hidden = true;
|
|
}
|
|
else
|
|
{
|
|
this.btnReject.Hidden = true;
|
|
this.btnReject_1.Hidden = false;
|
|
}
|
|
//this.btnReject.Hidden = false;
|
|
}
|
|
|
|
if (_Model.State == (int)InvoiceState.Apply)
|
|
{
|
|
this.btnOK_1.Hidden = true;//中文隐藏 英文也隐藏
|
|
this.btnOK.Hidden = true;//确定修改
|
|
this.btnApply.Hidden = true;//提交申请
|
|
this.btnApply_1.Hidden = true;//中文隐藏 英文也隐藏
|
|
this.btnReject.Hidden = true;//发票作废
|
|
this.btnReject_1.Hidden = true;
|
|
this.btnMail.Hidden = true;//寄出发票
|
|
this.btnMail_1.Hidden = true;//中文隐藏 英文也隐藏
|
|
|
|
|
|
}
|
|
|
|
if (_Model.State == (int)InvoiceState.Mail)
|
|
{
|
|
this.btnOK_1.Hidden = true;//中文隐藏 英文也隐藏
|
|
this.btnOK.Hidden = true;//确定修改
|
|
this.btnApply.Hidden = true;//提交申请
|
|
this.btnApply_1.Hidden = true;
|
|
this.btnReject.Hidden = true;//发票作废
|
|
this.btnReject_1.Hidden = true;
|
|
this.btnMail.Hidden = true;//寄出发票
|
|
this.btnMail_1.Hidden = true;//中文隐藏 英文也隐藏
|
|
|
|
txtInvoiceNumber.Readonly = true;
|
|
txtInvoiceNumber.Required = false;
|
|
|
|
txtExpressNumber.Readonly = true;
|
|
txtExpressNumber.Required = false;
|
|
|
|
txtContractPrice1.Readonly = true;
|
|
txtContractPrice1.Required = false;
|
|
|
|
txtBlancePrice1.Readonly = true;
|
|
txtBlancePrice1.Required = false;
|
|
}
|
|
|
|
if ( _Model.State == (int)InvoiceState.FinanceFail || _Model.State == (int)InvoiceState.CheckSuccess )
|
|
{
|
|
txtInvoiceNumber.Readonly = false;
|
|
txtInvoiceNumber.Required = true;
|
|
txtExpressNumber.Readonly = false;
|
|
txtContractPrice1.Readonly = true;
|
|
txtContractPrice1.Required = false;
|
|
txtBlancePrice1.Readonly = true;
|
|
txtBlancePrice1.Required = false;
|
|
string la = GetCurrentLanguage();
|
|
if (la == "CH")
|
|
{
|
|
this.btnMail.Hidden = false;
|
|
this.btnMail_1.Hidden = true;
|
|
this.btnReject.Hidden = false;
|
|
this.btnReject_1.Hidden = true;
|
|
}
|
|
else
|
|
{
|
|
this.btnMail.Hidden = true;
|
|
this.btnMail_1.Hidden = false;
|
|
this.btnReject.Hidden = true;
|
|
this.btnReject_1.Hidden = false;
|
|
}
|
|
//this.btnReject.Hidden = false;
|
|
txtContractPrice1.Readonly = true;
|
|
txtContractPrice1.Required = false;
|
|
txtContractPrice1.Enabled = false;
|
|
|
|
txtBlancePrice1.Readonly = false;
|
|
|
|
|
|
}
|
|
if (_Model.State ==(int) InvoiceState.CheckSuccess)
|
|
{
|
|
this.btnOK_1.Hidden = true;//中文隐藏 英文也隐藏
|
|
this.btnOK.Hidden = true;
|
|
txtMemo.Enabled = false;
|
|
|
|
for (int i = 0, count = Grid1.Rows.Count; i < count; i++)
|
|
{
|
|
object[] rowDataKeys = Grid1.DataKeys[i];
|
|
GridRow row = Grid1.Rows[i];
|
|
|
|
var txtPrice = (System.Web.UI.WebControls.TextBox)row.FindControl("txtPrice");
|
|
var txtQty = (System.Web.UI.WebControls.TextBox)row.FindControl("txtQty");
|
|
var txtLineMemo = (System.Web.UI.WebControls.TextBox)row.FindControl("txtLineMemo");
|
|
|
|
|
|
txtPrice.ReadOnly = true;
|
|
txtPrice.Enabled = false;
|
|
txtQty.ReadOnly = true;
|
|
txtQty.Enabled = false;
|
|
txtLineMemo.ReadOnly = true;
|
|
txtLineMemo.Enabled = false;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
protected void btnOK_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
var _invoice = Session["Invoice"] as V_TB_INVOICE;
|
|
|
|
string InvoiceNumber = MyWebString.GetString(this.txtInvoiceNumber.Text.Trim());
|
|
string Memo = MyWebString.GetString(this.txtMemo.Text.Trim());
|
|
string ExpressNumber = MyWebString.GetString(this.txtExpressNumber.Text.Trim());
|
|
string ContractPrice1 = MyWebString.GetString(this.txtContractPrice1.Text.Trim());//合同价格
|
|
string BlancePrice1 = MyWebString.GetString(this.txtBlancePrice1.Text.Trim());//合同差额
|
|
|
|
if (_invoice.State != (int)InvoiceState.New &&
|
|
_invoice.State != (int)InvoiceState.CheckFail)
|
|
{
|
|
Alert.Show(_invoice.InvcBillNum + GetResourceKey("不允许修改,只有状态为 新建 或 采购退回才能修改"));
|
|
return;
|
|
}
|
|
|
|
_invoice.InvoiceNum = InvoiceNumber;
|
|
_invoice.Remark = Memo;
|
|
_invoice.ExpressNum = ExpressNumber;
|
|
//_invoice.State = (int)InvoiceState.Apply;
|
|
|
|
if (string.IsNullOrEmpty(ContractPrice1))
|
|
{
|
|
_invoice.ContractPrice = 0;
|
|
}
|
|
|
|
if (string.IsNullOrEmpty(BlancePrice1))
|
|
{
|
|
_invoice.BlancePrice = 0;
|
|
}
|
|
|
|
|
|
decimal c1;
|
|
decimal b1;
|
|
if (decimal.TryParse(ContractPrice1, out c1))
|
|
{
|
|
_invoice.ContractPrice = c1;
|
|
}
|
|
else
|
|
{
|
|
Alert.Show(GetResourceKey("折扣金额请填写数字!"));
|
|
return;
|
|
}
|
|
|
|
if (decimal.TryParse(BlancePrice1, out b1))
|
|
{
|
|
_invoice.BlancePrice = b1;
|
|
}
|
|
else
|
|
{
|
|
Alert.Show(GetResourceKey("调整请填写数字!"));
|
|
return;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<V_TB_INVOICE_DETAIL> _ls = new List<V_TB_INVOICE_DETAIL>();
|
|
if (this.txtQty.ReadOnly == false)
|
|
{
|
|
|
|
for (int i = 0, count = Grid1.Rows.Count; i < count; i++)
|
|
{
|
|
object[] rowDataKeys = Grid1.DataKeys[i];
|
|
GridRow row = Grid1.Rows[i];
|
|
|
|
V_TB_INVOICE_DETAIL _entity = new V_TB_INVOICE_DETAIL();
|
|
_entity.UID = ConvertHelper.To<Int32>(rowDataKeys[0]);
|
|
_entity.InvcBillNum = rowDataKeys[1] as string;
|
|
_entity.Qty = ConvertHelper.To<Decimal>(rowDataKeys[2]);
|
|
_entity.CanQty = ConvertHelper.To<Decimal>(rowDataKeys[3]);
|
|
_entity.State = ConvertHelper.To<Int32>(rowDataKeys[4]);
|
|
_entity.BlancePrice= ConvertHelper.To<Decimal>(rowDataKeys[5]);
|
|
var txtQty = (System.Web.UI.WebControls.TextBox)row.FindControl("txtQty");
|
|
var txtPrice = (System.Web.UI.WebControls.TextBox)row.FindControl("txtPrice");
|
|
var txtLineMemo = (System.Web.UI.WebControls.TextBox)row.FindControl("txtLineMemo");
|
|
_entity.UpdateTime = DateTime.Now;
|
|
_entity.UpdateUser = CurrentUser.Name;
|
|
_entity.UpdateInfo = "发票修改";
|
|
//var txtContractPrice = (System.Web.UI.WebControls.TextBox)row.FindControl("txtContractPrice");
|
|
//var txtBlancePrice = (System.Web.UI.WebControls.TextBox)row.FindControl("txtBlancePrice");
|
|
decimal QtyNew = 0;
|
|
try
|
|
{
|
|
if (txtQty.Text.Trim() != "")
|
|
{
|
|
QtyNew = Convert.ToDecimal(txtQty.Text.Trim());
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
Alert.Show(GetResourceKey("开票数量输入不正确"));
|
|
return;
|
|
}
|
|
|
|
if (QtyNew > _entity.CanQty + _entity.Qty)
|
|
{
|
|
Alert.Show(GetResourceKey("开票数量不能大于可用开数票"));
|
|
return;
|
|
|
|
}
|
|
|
|
decimal PriceNew = 0;
|
|
try
|
|
{
|
|
if (txtPrice.Text.Trim() != "")
|
|
{
|
|
PriceNew = Convert.ToDecimal(txtPrice.Text.Trim());
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
Alert.Show(GetResourceKey("单价输入不正确"));
|
|
return;
|
|
}
|
|
|
|
|
|
_entity.Remark = txtLineMemo.Text;
|
|
_entity.Price = PriceNew;
|
|
_entity.Qty = QtyNew;
|
|
|
|
_ls.Add(_entity);
|
|
|
|
}
|
|
}
|
|
|
|
if (_ls.Count > 0)
|
|
{
|
|
string flag = "";
|
|
if (CurrentUser.FactoryList.FirstOrDefault() == EnumHelper.GetDescription(Domain.北京北汽模朔))
|
|
{
|
|
flag = EnumHelper.GetDescription(Domain.北京北汽模朔);
|
|
}
|
|
var ret = SCP_INVOICE_CONTROLLER.SAVE_TB_INVOICE_APPLY(_invoice, _ls, flag);
|
|
if (ret.State == ReturnStatus.Succeed)
|
|
{
|
|
|
|
Alert.Show(GetResourceKey("发票明细修改成功!"));
|
|
|
|
BindData();
|
|
}
|
|
else
|
|
{
|
|
Alert.Show(GetResourceKey(string.Join("<br>", ret.MessageList)));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Alert.Show(GetResourceKey("更改记录数为零"));
|
|
}
|
|
|
|
}
|
|
private void SET_INVOICE_STATE(string p_msg, InvoiceState p_state)
|
|
{
|
|
if ((string.IsNullOrEmpty(StartTime.SelectedDate.ToString()) || string.IsNullOrEmpty(EndTimeb.SelectedDate.ToString()))&& p_state == InvoiceState.Apply)
|
|
{
|
|
Alert.Show(GetResourceKey("对账开始日期,对账结束日期不能为空"));
|
|
return;
|
|
}
|
|
if (Session["Invoice"] != null)
|
|
{
|
|
var _Invoice = Session["Invoice"] as V_TB_INVOICE;
|
|
|
|
string InvoiceNumber = MyWebString.GetString(this.txtInvoiceNumber.Text.Trim());//金税票号
|
|
string ExpressNumber = MyWebString.GetString(this.txtExpressNumber.Text.Trim());//快递单号
|
|
|
|
string ContractPrice1 = MyWebString.GetString(this.txtContractPrice1.Text.Trim());//合同价格
|
|
string BlancePrice1 = MyWebString.GetString(this.txtBlancePrice1.Text.Trim());//合同差额
|
|
|
|
_Invoice.InvoiceNum = InvoiceNumber;
|
|
_Invoice.ExpressNum = ExpressNumber;
|
|
_Invoice.UpdateTime = dpUpdateTime.SelectedDate;
|
|
_Invoice.StartTime = StartTime.SelectedDate;
|
|
_Invoice.EndTimeb = EndTimeb.SelectedDate;
|
|
if (string.IsNullOrEmpty(ContractPrice1))
|
|
{
|
|
_Invoice.ContractPrice = 0;
|
|
}
|
|
if (string.IsNullOrEmpty(BlancePrice1))
|
|
{
|
|
_Invoice.BlancePrice = 0;
|
|
}
|
|
|
|
decimal c1;
|
|
decimal b1;
|
|
if (decimal.TryParse(ContractPrice1, out c1))
|
|
{
|
|
_Invoice.ContractPrice = c1;
|
|
}
|
|
else
|
|
{
|
|
_Invoice.ContractPrice = 0;
|
|
}
|
|
|
|
if (decimal.TryParse(BlancePrice1, out b1))
|
|
{
|
|
_Invoice.BlancePrice = b1;
|
|
}
|
|
else
|
|
{
|
|
_Invoice.BlancePrice = 0;
|
|
}
|
|
|
|
if (p_state == InvoiceState.Mail)
|
|
{
|
|
if (InvoiceNumber.Length > 22)
|
|
{
|
|
Alert.Show(GetResourceKey("金税票号最多22位!"));
|
|
return;
|
|
}
|
|
if (string.IsNullOrEmpty(InvoiceNumber))
|
|
{
|
|
Alert.Show(GetResourceKey("请填写金税票号!"));
|
|
return;
|
|
}
|
|
|
|
if (string.IsNullOrEmpty(ExpressNumber))
|
|
{
|
|
Alert.Show(GetResourceKey("请填写快递单号!"));
|
|
return;
|
|
}
|
|
if (dpUpdateTime.SelectedDate == null)
|
|
{
|
|
Alert.Show(GetResourceKey("发票时间必须填写,时间为纸质发票开票时间"));
|
|
return;
|
|
}
|
|
|
|
}
|
|
string flag = "";
|
|
if (CurrentUser.FactoryList.FirstOrDefault() == EnumHelper.GetDescription(Domain.北京北汽模朔))
|
|
{
|
|
flag = EnumHelper.GetDescription(Domain.北京北汽模朔);
|
|
}
|
|
var ret = SCP_INVOICE_CONTROLLER.SAVE_TB_INVOICE_STATE(_Invoice, p_state, CurrentUser.ChineseName, flag);
|
|
if (ret.State == ReturnStatus.Succeed)
|
|
{
|
|
Alert.Show(p_msg);
|
|
|
|
BindData();
|
|
GetInvoice();
|
|
}
|
|
else
|
|
{
|
|
Alert.Show(ret.Message);
|
|
}
|
|
}
|
|
}
|
|
|
|
protected void btnApply_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
SET_INVOICE_STATE(GetResourceKey("发票申请成功!"), InvoiceState.Apply);
|
|
|
|
}
|
|
|
|
protected void btnMail_Click(object sender, EventArgs e)
|
|
{
|
|
SET_INVOICE_STATE(GetResourceKey("发票已经寄出!"), InvoiceState.Mail);
|
|
}
|
|
|
|
protected void btnReject_Click(object sender, EventArgs e)
|
|
{
|
|
SET_INVOICE_STATE(GetResourceKey("发票已经作废!"), InvoiceState.Reject);
|
|
}
|
|
|
|
protected void Window1_OnClose(object sender, WindowCloseEventArgs e)
|
|
{
|
|
//string id = GetQueryValue("ID");
|
|
|
|
//TB_INVOICE model = InvoiceController.GetDataByBillInvoiceBillNum(id);
|
|
//InvoiceController.UpdateDataRemark(e.CloseArgument, model);
|
|
|
|
}
|
|
|
|
protected void btnRed_Click(object sender, EventArgs e)
|
|
{
|
|
string id = GetQueryValue("ID");
|
|
V_TB_INVOICE _tb = new V_TB_INVOICE();
|
|
_tb.InvcBillNum = id;
|
|
var ret = SCP_INVOICE_CONTROLLER.Add_New_Red_Invoice(_tb);
|
|
|
|
if (ret.State == ReturnStatus.Succeed)
|
|
{
|
|
BindData();
|
|
GetInvoice();
|
|
}
|
|
}
|
|
|
|
protected void Grid1_RowDataBound(object sender, GridRowEventArgs e)
|
|
{
|
|
System.Web.UI.WebControls.TextBox _label = (System.Web.UI.WebControls.TextBox)Grid1.Rows[e.RowIndex].FindControl("txtQty");
|
|
if (!string.IsNullOrEmpty(_label.Text))
|
|
{
|
|
if (decimal.Parse(_label.Text) < 0)
|
|
{
|
|
_label.ForeColor = Color.Red;
|
|
}
|
|
}
|
|
System.Web.UI.WebControls.DropDownList ddlTemporaryPrice = (System.Web.UI.WebControls.DropDownList)Grid1.Rows[e.RowIndex].FindControl("ddlTemporaryPrice");
|
|
V_TB_INVOICE_DETAIL row = e.DataItem as V_TB_INVOICE_DETAIL;
|
|
|
|
int TemporaryPrice = Convert.ToInt32(row.TemporaryPrice);
|
|
if (TemporaryPrice == 1)
|
|
{
|
|
ddlTemporaryPrice.SelectedValue = "1";
|
|
ddlTemporaryPrice.ForeColor = Color.Red;
|
|
}
|
|
else
|
|
{
|
|
ddlTemporaryPrice.SelectedValue = "0";
|
|
}
|
|
}
|
|
}
|
|
}
|