public static Ui.DataGrid GetContract_CustomerGrid(int ContractID, string orderBy, long startRowIndex, int pageSize) { long totalRows = 0; List <SqlParameter> parameters = new List <SqlParameter>(); List <string> conditions = new List <string>(); conditions.Add("[ContractID]=@ContractID"); parameters.Add(new SqlParameter("@ContractID", ContractID)); string fieldList = "[Contract_Customer].*"; string Statement = " from [Contract_Customer] where " + string.Join(" and ", conditions.ToArray()); var list = GetList <Contract_Customer>(fieldList, Statement, parameters, orderBy, startRowIndex, pageSize, out totalRows).ToArray(); if (list.Length > 0) { var chargeList = ChargeSummary.GetChargeSummaries().ToArray(); list = list.Select(p => { var myChargeList = chargeList.Where(q => p.ChargeIDList.Contains(q.ID)).ToArray(); if (myChargeList.Length > 0) { p.ChargeName = string.Join(",", myChargeList.Select(q => q.Name).ToArray()); } return(p); }).ToArray(); } DataAccess.Ui.DataGrid dg = new Ui.DataGrid(); dg.rows = list; dg.total = totalRows; dg.page = pageSize; return(dg); }
protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrEmpty(Request.QueryString["FeeID"])) { Response.End(); return; } int FeeID = 0; if (!int.TryParse(Request.QueryString["FeeID"], out FeeID)) { Response.End(); return; } chargeFee = Foresight.DataAccess.ChargeFee.GetChargeFee(FeeID); if (chargeFee == null) { Response.End(); return; } this.tbUnitPrice.Value = chargeFee.UnitPrice.ToString(); this.tbStartTime.Value = chargeFee.StartTime.ToString("yyyy-MM-dd"); this.tbEndType.Value = chargeFee.EndTypeID.ToString(); chargeSummary = ChargeSummary.GetChargeSummary(chargeFee.ChargeID); this.tbName.Value = chargeSummary.Name; }
public override void OpenEditForm() { switch (ActiveItem.ETipoCobro) { case ETipoCobro.Cliente: { ChargeSummary item = ChargeSummary.GetByCliente(ActiveItem.OidCliente); CobroEditForm form = new CobroEditForm(ActiveItem.OidCliente, item, ActiveItem, this); if (form.Entity != null) { form.Select(ActiveItem); AddForm(form); } } break; case ETipoCobro.REA: { try { Library.Common.EntityBase.CheckEditAllowedEstado(ActiveItem.EEstado, EEstado.Abierto); } catch (iQException ex) { PgMng.ShowInfoException(ex); _action_result = DialogResult.Ignore; return; } REAChargeEditForm form = new REAChargeEditForm(ActiveOID, this); if (form.Entity != null) { AddForm(form); } } break; case ETipoCobro.Fomento: { try { Library.Common.EntityBase.CheckEditAllowedEstado(ActiveItem.EEstado, EEstado.Abierto); } catch (iQException ex) { PgMng.ShowInfoException(ex); _action_result = DialogResult.Ignore; return; } CobroFomentoEditForm form = new CobroFomentoEditForm(ActiveOID, this); if (form.Entity != null) { AddForm(form); } } break; } }
private void SetInfo(ChargeMeter_Project data) { this.tdMeterName.Value = data.MeterName; this.tdMeterNumber.Value = data.MeterNumber; this.tdMeterCategory.Value = data.MeterCategoryID > 0 ? data.MeterCategoryID.ToString() : ""; this.tdMeterType.Value = data.MeterType > 0 ? data.MeterType.ToString() : ""; this.tdMeterSpec.Value = data.MeterSpec > 0 ? data.MeterSpec.ToString() : ""; this.tdMeterCoefficient.Value = data.MeterCoefficient > decimal.MinValue ? data.MeterCoefficient.ToString() : ""; var charge = ChargeSummary.GetChargeSummary(data.MeterChargeID); if (charge != null) { this.tdChargeSummary.InnerHtml = charge.Name; } this.tdMeterHouseNo.Value = data.MeterHouseNo; this.tdMeterLocation.Value = data.MeterLocation; this.tdSortOrder.Value = data.SortOrder > int.MinValue ? data.SortOrder.ToString() : ""; this.tdMeterRemark.Value = data.MeterRemark; var project = Project.GetProject(data.ProjectID); if (project != null) { this.tdProjectNames.InnerHtml = project.FullName + "-" + project.Name; } }
public virtual void ShowCobrosAction() { ClienteInfo cliente = ClienteInfo.Get(ActiveItem.OidHolder, true); ChargeSummary item = ChargeSummary.Get(cliente); CobroEditForm form = new CobroEditForm(cliente.Oid, item, null, this); form.ShowDialog(this); }
private void DeleteCharge_TI_Click(object sender, EventArgs e) { ClienteInfo cliente = ClienteInfo.Get(_entity.OidCliente, true); ChargeSummary item = ChargeSummary.Get(cliente); CobroEditForm form = new CobroEditForm(cliente.Oid, item, null, this); form.ShowDialog(this); }
public void GotoCobrosAction() { if (ActiveItem.EEstado == EEstado.Anulado) { return; } CobroEditForm form = new CobroEditForm(ActiveOID, ChargeSummary.Get(ActiveItem), this); form.ShowDialog(this); }
public CobrosREAEditForm(ChargeInfo cobro, Form parent) : base(cobro, parent) { InitializeComponent(); _cobro = cobro; _resumen = ChargeSummary.Get(ETipoCobro.REA); SetFormData(); this.Text = Resources.Labels.COBRO_REA_EDIT_TITLE; _mf_type = ManagerFormType.MFEdit; }
public CobroEditForm(long oid_cliente, ChargeSummary resumen, ChargeInfo cobro, Form parent) : base(oid_cliente, parent) { InitializeComponent(); _resumen = resumen; _cobro = cobro; if (Entity != null) { SetFormData(); this.Text = Resources.Labels.COBRO_EDIT_TITLE + " " + Entity.Nombre.ToUpper(); } _mf_type = ManagerFormType.MFEdit; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { var list = ChargeSummary.GetChargeSummaries().Where(p => p.IsReading).ToArray(); var items = list.Select(p => { var item = new { id = p.ID, name = p.Name }; return(item); }).ToList(); this.hdChargeIDList.Value = JsonConvert.SerializeObject(items); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int ID = 0; this.tdSummaryUnitPrice.Value = "0"; if (int.TryParse(Request.QueryString["ID"], out ID)) { ChargeSummary summary = ChargeSummary.GetChargeSummary(ID); this.tdName.Value = summary.Name; this.tdSummaryUnitPrice.Value = summary.SummaryUnitPrice == decimal.MinValue ? "0" : summary.SummaryUnitPrice.ToString(); this.tbAllowImport.Value = summary.IsAllowImport ? "1" : "0"; this.tbEndNumberCount.Value = summary.EndNumberCount == int.MinValue ? "2" : summary.EndNumberCount.ToString(); } } }
protected void Page_Load(object sender, EventArgs e) { ChargeID = 0; int.TryParse(Request.QueryString["ChargeID"], out ChargeID); if (ChargeID <= 0) { Response.End(); return; } var summary = ChargeSummary.GetChargeSummary(ChargeID); if (summary == null) { Response.End(); return; } }
protected override void SetRowFormat(DataGridViewRow row) { if (!row.Displayed) { return; } if (row.IsNewRow) { return; } ChargeSummary item = row.DataBoundItem as ChargeSummary; if (item == null) { return; } if (item.LimiteCredito < item.CreditoDispuesto) { row.Cells[CreditoDispuesto.Name].Style.BackColor = Color.Red; row.Cells[CreditoDispuesto.Name].Style.SelectionBackColor = Color.Red; } else if (item.CreditoDispuesto > 0) { row.Cells[CreditoDispuesto.Name].Style.BackColor = Color.FromArgb(255, 192, 128); row.Cells[CreditoDispuesto.Name].Style.SelectionBackColor = Color.FromArgb(255, 192, 128); } else { row.Cells[CreditoDispuesto.Name].Style.BackColor = Color.White; row.Cells[CreditoDispuesto.Name].Style.SelectionBackColor = row.Cells[LimiteCredito.Name].Style.SelectionBackColor; } if (item.DudosoCobro > 0) { row.Cells[DudosoCobro.Name].Style.BackColor = Color.Red; row.Cells[DudosoCobro.Name].Style.SelectionBackColor = Color.Red; } else { row.Cells[DudosoCobro.Name].Style.BackColor = Color.White; row.Cells[DudosoCobro.Name].Style.SelectionBackColor = row.Cells[LimiteCredito.Name].Style.SelectionBackColor; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.hdChargeType.Value = "1"; this.hdCategory.Value = "1"; int ID = 0; if (int.TryParse(Request.QueryString["ID"], out ID)) { ChargeSummary summary = ChargeSummary.GetChargeSummary(ID); this.tdName.Value = summary.Name; this.hdChargeType.Value = summary.TypeID.ToString(); this.hdCategory.Value = summary.CategoryID.ToString(); this.tdSummaryUnitPrice.Value = summary.SummaryUnitPrice == decimal.MinValue ? "0.00" : summary.SummaryUnitPrice.ToString(); this.hdEndNumber.Value = summary.EndNumber == int.MinValue ? "2" : summary.EndNumber.ToString(); this.tdOrderBy.Value = summary.OrderBy == int.MinValue ? "" : summary.OrderBy.ToString(); this.tdIsReading.Value = summary.IsReading ? "1" : "0"; } } }
private static decimal DoCalculateUseCount(RoomBasic basic, ChargeSummary summary) { decimal CalculateUseCount = 0; if (summary.CalculateAreaType.Equals(Utility.EnumModel.ChargeSummaryCalculateAreaType.jifei.ToString())) { CalculateUseCount = basic.BuildingArea; } else if (summary.CalculateAreaType.Equals(Utility.EnumModel.ChargeSummaryCalculateAreaType.jianzhu.ToString())) { CalculateUseCount = basic.BuildOutArea; } else if (summary.CalculateAreaType.Equals(Utility.EnumModel.ChargeSummaryCalculateAreaType.taonei.ToString())) { CalculateUseCount = basic.BuildInArea; } else if (summary.CalculateAreaType.Equals(Utility.EnumModel.ChargeSummaryCalculateAreaType.gongtan.ToString())) { CalculateUseCount = basic.GonTanArea; } else if (summary.CalculateAreaType.Equals(Utility.EnumModel.ChargeSummaryCalculateAreaType.chanquan.ToString())) { CalculateUseCount = basic.ChanQuanArea; } else if (summary.CalculateAreaType.Equals(Utility.EnumModel.ChargeSummaryCalculateAreaType.shiyong.ToString())) { CalculateUseCount = basic.UseArea; } else if (summary.CalculateAreaType.Equals(Utility.EnumModel.ChargeSummaryCalculateAreaType.peitao.ToString())) { CalculateUseCount = basic.PeiTaoArea; } if (CalculateUseCount > 0) { return(CalculateUseCount); } return(basic.ContractArea > 0 ? basic.ContractArea : 0); }
public void GoToSourceAction() { if (ActiveItem == null) { return; } if (ActiveItem.EEstado == EEstado.Anulado) { return; } switch (ActiveItem.ETipoMovimientoBanco) { case EBankLineType.Cobro: { switch (ActiveItem.ETipoTitular) { case ETipoTitular.Cliente: { ClienteInfo cliente = ClienteInfo.Get(ActiveItem.OidTitular, true); ChargeSummary item = ChargeSummary.Get(cliente); CobroEditForm form = new CobroEditForm(cliente.Oid, item, null, this); form.ShowDialog(this); } break; case ETipoTitular.Fomento: { ChargeInfo cobro = ChargeInfo.Get(ActiveItem.OidTitular, ETipoCobro.Fomento, false); CobrosFomentoEditForm form = new CobrosFomentoEditForm(cobro, this); form.ShowDialog(this); } break; case ETipoTitular.REA: { ChargeInfo cobro = ChargeInfo.Get(ActiveItem.OidTitular, ETipoCobro.REA, false); CobrosREAEditForm form = new CobrosREAEditForm(cobro, this); form.ShowDialog(); } break; } } break; case EBankLineType.PagoFactura: { ETipoAcreedor tipo = moleQule.Library.Store.EnumConvert.ToETipoAcreedor(ActiveItem.ETipoTitular); if ((new List <ETipoTitular> { ETipoTitular.TransportistaOrigen, ETipoTitular.TransportistaOrigen }).Contains(ActiveItem.ETipoTitular)) { TransporterInfo transporter = TransporterInfo.Get(ActiveItem.OidTitular, moleQule.Library.Store.EnumConvert.ToETipoAcreedor(ActiveItem.ETipoTitular), false); tipo = transporter.ETipoAcreedor; } PaymentSummary item = PaymentSummary.Get(tipo, ActiveItem.OidTitular); PaymentEditForm form = new PaymentEditForm(this, ActiveItem.OidTitular, item); form.ShowDialog(this); } break; case EBankLineType.PagoGasto: { ExpensePaymentEditForm form = new ExpensePaymentEditForm(ActiveItem.OidTitular, ETipoPago.Gasto, this); form.ShowDialog(); } break; case EBankLineType.PagoNomina: { PaymentSummary item = PaymentSummary.Get(ETipoAcreedor.Empleado, ActiveItem.OidTitular); EmployeePaymentEditForm form = new EmployeePaymentEditForm(this, ActiveItem.OidTitular, item); form.ShowDialog(); } break; case EBankLineType.PagoPrestamo: { LoanPaymentEditForm form = new LoanPaymentEditForm(ActiveItem.OidTitular, ETipoPago.Prestamo, this); form.ShowDialog(); } break; case EBankLineType.Prestamo: { LoanEditForm form = new LoanEditForm(ActiveItem.OidTitular, this); form.ShowDialog(); } break; case EBankLineType.EntradaCaja: case EBankLineType.SalidaCaja: { CashLineInfo linea = CashLineInfo.Get(ActiveItem.OidOperacion); if (linea.OidCierre != 0) { CashCountEditForm form = new CashCountEditForm(linea.OidCierre, this); form.ShowDialog(); } else { CashEditForm form = new CashEditForm(linea.OidCaja, this); form.ShowDialog(); } } break; case EBankLineType.Traspaso: { TraspasoEditForm form = new TraspasoEditForm(ActiveItem.OidTitular, this); form.ShowDialog(); } break; case EBankLineType.ExtractoTarjeta: { CreditCardPaymentEditForm form = new CreditCardPaymentEditForm(ActiveItem.OidOperacion, ETipoPago.ExtractoTarjeta, this); form.Show(); } break; } }
private void importgongtan(HttpContext context) { HttpFileCollection uploadFiles = context.Request.Files; if (uploadFiles.Count == 0) { context.Response.Write("请选择一个文件"); return; } if (string.IsNullOrEmpty(uploadFiles[0].FileName)) { context.Response.Write("请选择一个文件"); return; } string msg = string.Empty; int CompanyID = WebUtil.GetCompanyID(context); int CreatorID = WebUtil.GetUser(context).UserID; string AddMan = WebUtil.GetUser(context).RealName; bool ImportFailed = false; var summarylist = ChargeSummary.GetChargeSummaries().ToArray(); titleList = Foresight.DataAccess.TableColumn.GetTableColumnByPageCode("roomfeesource", true).Where(p => !p.ColumnName.Equals("选择按钮")).ToArray(); using (SqlHelper helper = new SqlHelper()) { try { helper.BeginTransaction(); #region 导入处理 for (int j = 0; j < uploadFiles.Count; j++) { HttpPostedFile postedFile = uploadFiles[j]; string filepath = HttpContext.Current.Server.MapPath("~/upload/ImportChaoBiao/" + DateTime.Now.ToString("yyyyMMdd")); if (!System.IO.Directory.Exists(filepath)) { System.IO.Directory.CreateDirectory(filepath); } string filename = DateTime.Now.ToLocalTime().ToString("yyyyMMddHHmmss") + "_" + postedFile.FileName; string fullpath = Path.Combine(filepath, filename); postedFile.SaveAs(fullpath); DataTable table = ExcelExportHelper.NPOIReadExcel(fullpath); for (int i = 0; i < table.Rows.Count; i++) { Project project = null; object Value, FullName, RoomName; if (GetColumnValue("房源信息", table, i, out FullName) && GetColumnValue("房间号", table, i, out RoomName)) { project = Project.GetProjectByFullName(RoomName.ToString(), FullName.ToString(), CompanyID, helper); } if (project == null) { msg += "<p>第" + (i + 2) + "行上传失败。原因:房间资源不存在</p>"; ImportFailed = true; break; } ChargeSummary summary = null; if (GetColumnValue("收费项目", table, i, out Value)) { summary = summarylist.FirstOrDefault(p => p.CompanyID == CompanyID && p.Name.Equals(Value.ToString())); } if (summary == null) { msg += "<p>第" + (i + 2) + "行上传失败。原因:收费项目项目不存在</p>"; ImportFailed = true; break; } int ID = 0; int.TryParse(table.Rows[i]["账单ID"].ToString(), out ID); Foresight.DataAccess.ImportFee importFee = null; if (ID > 0) { importFee = Foresight.DataAccess.ImportFee.GetOrCreateImportFeeByID(ID, helper, CanCreate: false); } if (importFee == null) { importFee = new Foresight.DataAccess.ImportFee(); importFee.ChargeStatus = 0; importFee.AddTime = DateTime.Now; importFee.ChargeID = summary.ID; importFee.RoomID = project.ID; importFee.ChargeStatus = 2; } if (importFee.ChargeStatus == 1) { msg += "<p>第" + (i + 2) + "行上传失败。原因:该费用已收取</p>"; ImportFailed = true; break; } if (GetColumnValue("上次读数", table, i, out Value)) { importFee.StartPoint = GetDecimalValue(Value); } if (GetColumnValue("本次读数", table, i, out Value)) { importFee.EndPoint = GetDecimalValue(Value); } decimal totalpoint = decimal.MinValue; if (GetColumnValue("用量", table, i, out Value)) { totalpoint = GetDecimalValue(Value); } if (totalpoint == decimal.MinValue) { totalpoint = (importFee.EndPoint == decimal.MinValue ? 0 : importFee.EndPoint) - (importFee.StartPoint == decimal.MinValue ? 0 : importFee.StartPoint); } totalpoint = totalpoint < 0 ? 0 : totalpoint; importFee.TotalPoint = totalpoint; if (GetColumnValue("单价", table, i, out Value)) { importFee.UnitPrice = GetDecimalValue(Value); } if (GetColumnValue("系数", table, i, out Value)) { importFee.ImportCoefficient = GetDecimalValue(Value); } decimal totalprice = decimal.MinValue; if (GetColumnValue("金额", table, i, out Value)) { totalprice = GetDecimalValue(Value); } if (totalprice == decimal.MinValue) { totalprice = (importFee.TotalPoint == decimal.MinValue ? 0 : importFee.TotalPoint) * (importFee.ImportCoefficient == decimal.MinValue ? 0 : importFee.ImportCoefficient) * (importFee.UnitPrice == decimal.MinValue ? 0 : importFee.UnitPrice); } importFee.TotalPrice = totalprice; if (GetColumnValue("收费状态", table, i, out Value)) { importFee.ChargeStatus = Value.ToString().Equals("已收") ? 1 : (Value.ToString().Equals("未收") ? 0 : 2); } if (GetColumnValue("账单日期", table, i, out Value)) { importFee.WriteDate = GetDateTimeValue(Value); } if (GetColumnValue("计费开始日期", table, i, out Value)) { importFee.StartTime = GetDateTimeValue(Value); } if (GetColumnValue("计费结束日期", table, i, out Value)) { importFee.EndTime = GetDateTimeValue(Value); } string ImportBiaoCategory = string.Empty; string ImportBiaoName = project.Name; string ImportChargeRoomNo = string.Empty; if (GetColumnValue("表种类", table, i, out Value)) { ImportBiaoCategory = Value.ToString(); } if (GetColumnValue("表名称", table, i, out Value)) { ImportBiaoName = Value.ToString(); } if (GetColumnValue("缴费户号", table, i, out Value)) { ImportChargeRoomNo = Value.ToString(); } Foresight.DataAccess.ImportFee lastimportFee = Foresight.DataAccess.ImportFee.GetImportFeeByRoomID(project.ID, null, importFee.ChargeID, helper); if (string.IsNullOrEmpty(ImportBiaoCategory)) { ImportBiaoCategory = summary.BiaoCategory; if (lastimportFee != null && !string.IsNullOrEmpty(lastimportFee.ImportBiaoCategory)) { ImportBiaoCategory = lastimportFee.ImportBiaoCategory; } } if (string.IsNullOrEmpty(ImportBiaoName)) { ImportBiaoName = project.Name; if (lastimportFee != null && !string.IsNullOrEmpty(lastimportFee.ImportBiaoName)) { ImportBiaoName = lastimportFee.ImportBiaoName; } } if (string.IsNullOrEmpty(ImportChargeRoomNo)) { if (lastimportFee != null && !string.IsNullOrEmpty(lastimportFee.ImportChargeRoomNo)) { ImportChargeRoomNo = lastimportFee.ImportChargeRoomNo; } } importFee.ImportBiaoCategory = ImportBiaoCategory; importFee.ImportBiaoName = ImportBiaoName; importFee.ImportChargeRoomNo = ImportChargeRoomNo; importFee.Save(helper); if (importFee.ChargeStatus == 0) { SaveRoomFee(importFee, summary.ID, helper); } else if (importFee.ChargeStatus == 1) { SaveRoomHistoryFee(importFee, summary.ID, helper, AddMan); } } } #endregion if (!ImportFailed) { helper.Commit(); msg += "<p>导入完成</p>"; } else { helper.Rollback(); msg += "<p>导入失败</p>"; } } catch (Exception ex) { LogHelper.WriteError("ImportGongTanHandler", "visit: importgongtan", ex); helper.Rollback(); } context.Response.Write(msg); } }
public CobroEditForm(long oid_cliente, ChargeSummary resumen, Form parent) : this(oid_cliente, resumen, null, parent) { }