/// <summary> /// 获取发票的等额人民币价值,汇率按照开票时间计算 /// </summary> /// <param name="ID"></param> /// <returns></returns> public string GetAmout(VoyageLCLInfo vInfo) { // 运费、滞期、速遣合计 string total = NumericHandler.StringAdd( NumericHandler.StringAdd(vInfo.Fee, vInfo.DelayAmount), vInfo.DispatchAmount); decimal dTotal = decimal.Parse(total); return dTotal.ToString(); }
/// <summary> /// 增改船舶装箱情况 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(this.VoyageId)) { ShowMsg("请先保存航次信息。"); return; } ShipInfo sInfo = new Ship().GetByID(ddlShipName.SelectedValue); switch (sInfo.LoadTypeEnum) { case ShipType.LCL: VoyageLCLInfo vlInfo = new VoyageLCL().GetByVoyageID(this.VoyageId); if (vlInfo == null) { vlInfo = new VoyageLCLInfo(); } vlInfo.VoyageID = this.VoyageId; vlInfo.Customer = tbCustomer.Text; vlInfo.TaxNo = tbTaxNo.Text; vlInfo.User1 = tbLCLUser1.Text; vlInfo.User2 = tbLCLUser2.Text; vlInfo.User3 = tbLCLUser3.Text; vlInfo.LCLAmount = tbLCLAmount.Text; vlInfo.LCLAmountReal = tbLCLAmountReal.Text; vlInfo.LCLCatalog = tbLCLName.Text; vlInfo.LCLPrice = tbTransport.Text; vlInfo.CurrencyID = ddlCurrency.SelectedValue; vlInfo.DelayDay = tbDelay.Text; vlInfo.DelayRate = tbDelayFee.Text; vlInfo.QuickDay = tbDispatch.Text; vlInfo.QuickRate = tbDispatchFee.Text; lbTotal.Text = new VoyageLCL().GetAmout(vlInfo); vlInfo.Amount = lbTotal.Text; lbTotalRMB.Text = new VoyageLCL().GetRMBAmout(vlInfo); lbLCLCName.Text = ddlCurrency.SelectedItem.Text; if (string.IsNullOrEmpty(vlInfo.ID)) { new VoyageLCL().Add(vlInfo); } else { new VoyageLCL().Update(vlInfo); } lbDelayAmount.Text = vlInfo.DelayAmount; lbDelayRMB.Text = new ExchangeRate().GetRMB(vlInfo.DelayAmount, vlInfo.CurrencyID, vlInfo.CreateTime).ToString(); lbDispatchAmount.Text = vlInfo.DispatchAmount; lbDispatchRMB.Text = new ExchangeRate().GetRMB(vlInfo.DispatchAmount, vlInfo.CurrencyID, vlInfo.CreateTime).ToString(); break; case ShipType.FCL: //集装箱 VoyageFCLInfo vfInfo = new VoyageFCL().GetByVoyageID(this.VoyageId); if (vfInfo == null) { vfInfo = new VoyageFCLInfo(); } vfInfo.VoyageID = this.VoyageId; vfInfo.Customer = tbCustomer.Text; vfInfo.TaxNo = tbTaxNo.Text; vfInfo.Amount = tbFCLFee.Text; vfInfo.User1 = tbFCLUser1.Text; vfInfo.User2 = tbFCLUser2.Text; vfInfo.User3 = tbFCLUser3.Text; vfInfo.Fee = tbFCLFee.Text; vfInfo.BeginFee = tbBeginFee.Text; vfInfo.EndFee = tbEndFee.Text; vfInfo.OilFee = tbOilFee.Text; vfInfo.Tally = tbTally.Text; vfInfo.Box = tbBox.Text; vfInfo.Other = tbOther.Text; vfInfo.Subsidize = tbSubsidize.Text; vfInfo.BookFee = tbBookFee.Text; vfInfo.BranchOther = tbBranchOther.Text; lbFCLTotal.Text = new VoyageFCL().GetAmout(vfInfo); vfInfo.Amount = lbFCLTotal.Text; lbFCLTotalRMB.Text = new VoyageFCL().GetRMBAmout(vfInfo); vfInfo.Remark = tbFCLRemark.Text; if (string.IsNullOrEmpty(vfInfo.ID)) { new VoyageFCL().Add(vfInfo); } else { new VoyageFCL().Update(vfInfo); } break; default: break; } ShowMsg("操作成功!"); } catch (ArgumentNullException aex) { ShowMsg(aex.Message); } catch (Exception ex) { ShowMsg(ex.Message); Log(ex); } }
public string GetRMBAmout(VoyageLCLInfo vInfo) { // 运费、滞期、速遣合计 string total = GetAmout(vInfo); decimal dTotal = decimal.Parse(total); if (vInfo.CurrencyID != "1" && vInfo.InputDate == null) { return "--"; } decimal amount = new ExchangeRate().GetRMB(total, vInfo.CurrencyID, vInfo.CreateTime); return amount.ToString(); }
/// <summary> /// 添加费用类别 /// </summary> /// <param name="ID">实体主键</param> /// <returns></returns> public void Delete(string ID) { VoyageLCLInfo cInfo = new VoyageLCLInfo(ID); dal.Delete(cInfo); }
/// <summary> /// 更新费用类别 /// </summary> /// <param name="cInfo">实体</param> public void Update(VoyageLCLInfo cInfo) { if (string.IsNullOrEmpty(cInfo.ID)) { throw new ArgumentNullException("参数ID不能为空。"); } //string msg = string.Empty; //int restInt = 0; //int equalInt = 0; //if (int.TryParse(cInfo.Rest, out restInt) && int.TryParse(cInfo.EqualTo, out equalInt)) //{ // if (restInt > equalInt) // { // throw new ArgumentException("特殊的柜数目必须小于或者等于标准柜数目。"); // } //} dal.Update(cInfo); }
/// <summary> /// 添加费用类别 /// </summary> /// <param name="cInfo">实体</param> /// <returns>新增实体的主键</returns> public string Add(VoyageLCLInfo cInfo) { string msg = string.Empty; //int restInt = 0; //int equalInt = 0; //if (int.TryParse(cInfo.Rest, out restInt) && int.TryParse(cInfo.EqualTo, out equalInt)) //{ // if (restInt > equalInt) // { // throw new ArgumentException("特殊的柜数目必须小于或者等于标准柜数目。"); // } //} return dal.Add(cInfo); }