protected void btnOtherSave_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(this.VoyageId)) { ShowMsg("请先保存航次信息。"); return; } ShipInfo sInfo = new Ship().GetByID(ddlShipName.SelectedValue); VoyageOtherInfo voInfo = new VoyageOther().GetByVoyageID(this.VoyageId); if (voInfo == null) { voInfo = new VoyageOtherInfo(); } voInfo.VoyageID = this.VoyageId; voInfo.Customer = tbCustomer.Text; voInfo.Remark = tbRemark.Text; voInfo.User1 = tbOtherUser1.Text; voInfo.User2 = tbOtherUser2.Text; voInfo.User3 = tbOtherUser3.Text; voInfo.Amount = tbOtherFee.Text; voInfo.OtherName = tbOtherName.Text; voInfo.CurrencyID = ddlCurrencyOther.SelectedValue; if (string.IsNullOrEmpty(voInfo.ID)) { new VoyageOther().Add(voInfo); } else { new VoyageOther().Update(voInfo); } lbOtherRMB.Text = new ExchangeRate().GetRMB(voInfo.Amount, voInfo.CurrencyID, voInfo.CreateTime).ToString(); ShowMsg("操作成功!"); } catch (ArgumentNullException aex) { ShowMsg(aex.Message); } catch (Exception ex) { ShowMsg(ex.Message); Log(ex); } }
private void VoyageLoadInitial(VoyageInfo vInfo) { if (GetRequest("type") == "other") { divOther.Visible = true; divFCL.Visible = false; divLCL.Visible = false; } if (vInfo == null || string.IsNullOrEmpty(vInfo.ID)) { return; } #region 其他收入 if (GetRequest("type") == "other") { VoyageOtherInfo voInfo = new VoyageOther().GetByVoyageID(vInfo.ID); if (voInfo != null && string.IsNullOrEmpty(voInfo.ID) == false) { tbOtherName.Text = voInfo.OtherName; tbRemark.Text = voInfo.Remark; tbOtherFee.Text = voInfo.Amount; ddlCurrencyOther.SelectedValue = voInfo.CurrencyID; tbOtherUser1.Text = voInfo.User1; tbOtherUser2.Text = voInfo.User2; tbOtherUser3.Text = voInfo.User3; lbOtherRMB.Text = new ExchangeRate().GetRMB(voInfo.Amount, voInfo.CurrencyID, voInfo.CreateTime).ToString(); } return; } #endregion IList<PortInfo> pList = new Port().GetList(vInfo.RouteID.ToString(), string.Empty); gvList.DataSource = pList; gvList.DataBind(); ShipInfo sInfo = new Ship().GetByID(vInfo.ShipID.ToString()); switch (sInfo.LoadTypeEnum) { case ShipType.LCL: #region 散货 divLCL.Visible = true; // 散货 VoyageLCLInfo vlInfo = new VoyageLCL().GetByVoyageID(vInfo.ID); if (vlInfo != null && string.IsNullOrEmpty(vlInfo.ID) == false) { tbCustomer.Text = vlInfo.Customer; tbTaxNo.Text = vlInfo.TaxNo; tbLCLAmount.Text = vlInfo.LCLAmount; tbLCLAmountReal.Text = vlInfo.LCLAmountReal; tbLCLName.Text = vlInfo.LCLCatalog; tbTransport.Text = vlInfo.LCLPrice; ddlCurrency.SelectedValue = vlInfo.CurrencyID; lbAmount.Text = vlInfo.Fee; tbDelay.Text = vlInfo.DelayDay; tbDelayFee.Text = vlInfo.DelayRate; lbDelayAmount.Text = vlInfo.DelayAmount; lbDelayRMB.Text = new ExchangeRate().GetRMB(vlInfo.DelayAmount, vlInfo.CurrencyID, vlInfo.CreateTime).ToString(); tbDispatch.Text = vlInfo.QuickDay; tbDispatchFee.Text = vlInfo.QuickRate; lbDispatchAmount.Text = vlInfo.DispatchAmount; lbDispatchRMB.Text = new ExchangeRate().GetRMB(vlInfo.DispatchAmount, vlInfo.CurrencyID, vlInfo.CreateTime).ToString(); lbTotal.Text = new VoyageLCL().GetAmout(vlInfo); lbLCLCName.Text = ddlCurrency.SelectedItem.Text; lbTotalRMB.Text = new VoyageLCL().GetRMBAmout(vlInfo); tbLCLUser1.Text = vlInfo.User1; tbLCLUser2.Text = vlInfo.User2; tbLCLUser3.Text = vlInfo.User3; } #endregion break; case ShipType.FCL: #region 集装箱 divFCL.Visible = true; VoyageFCLInfo vfInfo = new VoyageFCL().GetByVoyageID(vInfo.ID); if (vfInfo != null && string.IsNullOrEmpty(vfInfo.ID) == false) { tbCustomer.Text = vfInfo.Customer; tbTaxNo.Text = vfInfo.TaxNo; tbFCLFee.Text = vfInfo.Amount; ddlCurrencyFCL.SelectedValue = vfInfo.CurrencyID; tbFCLUser1.Text = vfInfo.User1; tbFCLUser2.Text = vfInfo.User2; tbFCLUser3.Text = vfInfo.User3; tbFCLFee.Text = vfInfo.Fee; tbBeginFee.Text = vfInfo.BeginFee; tbEndFee.Text = vfInfo.EndFee; tbOilFee.Text = vfInfo.OilFee; tbTally.Text = vfInfo.Tally; tbBox.Text = vfInfo.Box; tbOther.Text = vfInfo.Other; tbSubsidize.Text = vfInfo.Subsidize; tbBookFee.Text = vfInfo.BookFee; tbBranchOther.Text = vfInfo.BranchOther; lbFCLTotal.Text = new VoyageFCL().GetAmout(vfInfo.ID); lbFCLTotalRMB.Text = new VoyageFCL().GetRMBAmout(vfInfo.ID); tbFCLRemark.Text = vfInfo.Remark; } #endregion break; default: break; } }
/// <summary> /// 绑定散货报表 /// </summary> private void BindOther(int pageIndex) { string shipID = MonthAndShipNavigate1.ShipID; string dateID = MonthAndShipNavigate1.DateID; DataSet ds = new VoyageOther().GetList(dateID, shipID, pGridV.PageSize, pageIndex); gvOther.DataSource = ds; gvOther.DataBind(); CustomDataSet cDS = ds as CustomDataSet; if (cDS == null) { pGridV.TotalAmout = 0; return; } pGridV.TotalAmout = cDS.TotalAmout; }
private void ShowResult() { trQuery.Visible = true; trStatistic.Visible = true; string fromDate = tbStartTime.Text; string toDate = tbEndTime.Text; string shipID = ddlShipName.SelectedValue; string voyage = tbVoyageName.Text; string type = rblType.SelectedValue; if (type == "0") { DataSet ds = new VoyageOther().GetDataSetByQuery(fromDate, toDate, shipID, voyage, 15, 0); gvVoyageList.DataSource = ds; gvVoyageList.DataBind(); trStatistic.Visible = false; } else if (type == "1") { DataSet ds = new VoyageOther().GetDataSetByStatistic(fromDate, toDate, shipID, 12, 0); gvStatistic.DataSource = ds; gvStatistic.DataBind(); trQuery.Visible = false; } }
protected void gvOther_RowDataBound(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.DataRow) { DataRowView dv = e.Row.DataItem as DataRowView; if (dv.Row["ID"] == null) { return; } string reportID = dv.Row["ID"].ToString(); if (string.IsNullOrEmpty(reportID)) { return; } VoyageOtherInfo vInfo = new VoyageOther().GetByID(reportID); Label lbTotal = (Label)e.Row.FindControl("lbTotal"); lbTotal.Text = new VoyageOther().GetRMBAmout(reportID); } if (e.Row.RowIndex >= 0) { Label lbTotal = (Label)e.Row.FindControl("lbTotal"); double result = 0; bool isDouble = Double.TryParse(lbTotal.Text, out result); if (isDouble) { sum += Convert.ToDouble(lbTotal.Text); } } else if (e.Row.RowType == DataControlRowType.Footer) { e.Row.Cells[8].Text = "总额相当于人民币:" + sum.ToString() + "元"; } } catch (ArgumentException ae) { this.ShowMsg(ae.Message); } catch (Exception exc) { ShowMsg(exc.Message); } }