/// <summary> /// Констурктор формы редактирования графика технического обслуживания. /// </summary> /// <param name="BaseCard">Родительская карточка.</param> /// <param name="Type">Тип проверки (техническое обслуживание)</param> /// <param name="DateOfEvent">Дата проведения.</param> /// <param name="NextDateOfEvent">Дата следующего проведения.</param> /// <param name="EmployeeId">Идентификатор сотрудника.</param> /// <param name="Document">Идентификатор карточки документа.</param> /// <param name="Interval">Периодичность проверки.</param> /// <param name="Unit">Единица измерения времени.</param> public MaintenanceForm(MyBaseCard BaseCard, RefEquipmentCard.Enums.TypeOfInspection Type, DateTime DateOfEvent, DateTime NextDateOfEvent, Guid EmployeeId, Guid Document, Decimal Interval, RefEquipmentCard.Enums.Units Unit) { InitializeComponent(); this.Location = ComputeLocation(this.Size); this.BaseCard = BaseCard; Context = BaseCard.Context; this.Type = Type; this.Interval = Interval; this.Unit = Unit; this.Text = "Данные о проведении технического обслуживания:"; if (DateOfEvent != DateTime.MinValue) { this.DateOfEvent.EditValue = DateOfEvent; } if (NextDateOfEvent != DateTime.MinValue) { this.NextDateOfEvent.EditValue = NextDateOfEvent; } RespEmployee = EmployeeId == Guid.Empty ? null : Context.GetObject <DocsVision.BackOffice.ObjectModel.StaffEmployee>(EmployeeId); DocumentCard = Document == Guid.Empty ? null : Context.GetObject <DocsVision.BackOffice.ObjectModel.Document>(Document); this.Employee.Text = RespEmployee == null ? "" : RespEmployee.DisplayName; this.Position.Text = RespEmployee == null || RespEmployee.Position == null ? "" : RespEmployee.Position.Name; this.Document.Text = DocumentCard == null ? "" : DocumentCard.MainInfo.FileName; }
/// <summary> /// Констурктор формы редактирования графика калиборовок/поверок/аттестаций /// </summary> /// <param name="BaseCard">Родительская карточка.</param> /// <param name="Type">Тип проверки (калибровка/поверка/аттестация).</param> /// <param name="DateOfEvent">Дата проведения.</param> /// <param name="NextDateOfEvent">Дата следующего проведения.</param> /// <param name="NumberOfDocument">Номер документа.</param> /// <param name="Document">Идентификатор карточки документа.</param> /// <param name="Interval">Периодичность проверки.</param> /// <param name="Unit">Единица измерения времени.</param> public GraphForm(MyBaseCard BaseCard, RefEquipmentCard.Enums.TypeOfInspection Type, DateTime DateOfEvent, DateTime NextDateOfEvent, String NumberOfDocument, Guid Document, Decimal Interval, RefEquipmentCard.Enums.Units Unit) { InitializeComponent(); this.Location = ComputeLocation(this.Size); this.BaseCard = BaseCard; Context = BaseCard.Context; this.Type = Type; this.Interval = Interval; this.Unit = Unit; switch (Type) { case RefEquipmentCard.Enums.TypeOfInspection.Verification: this.Text = "Данные о проведении поверки:"; break; case RefEquipmentCard.Enums.TypeOfInspection.Calibration: this.Text = "Данные о проведении калибровки:"; break; case RefEquipmentCard.Enums.TypeOfInspection.Attestation: this.Text = "Данные о проведении аттестации"; break; } if (DateOfEvent != DateTime.MinValue) { this.DateOfEvent.EditValue = DateOfEvent; } if (NextDateOfEvent != DateTime.MinValue) { this.NextDateOfEvent.EditValue = NextDateOfEvent; } this.NumberOfDocument.Text = NumberOfDocument; DocumentCard = Document == Guid.Empty ? null : Context.GetObject <DocsVision.BackOffice.ObjectModel.Document>(Document); this.Document.Text = DocumentCard == null ? "" : DocumentCard.MainInfo.FileName; }
/// <summary> /// Создать форму "Дополнительные изделия" /// </summary> /// <param name="Card"> Карточка заявки на сервисное обслуживание.</param> /// <param name="UniversalCard"> Карточка универсального справочника.</param> /// <param name="Table_AdditionalWaresList"> Контрол Дополнительные комплектующие.</param> public AdditionalWares(MyBaseCard Card, CardData UniversalCard, ITableControl Table_AdditionalWaresList) { T_AW = Table_AdditionalWaresList; this.Card = Card; this.UniversalCard = UniversalCard; TimeDiagnostics = new ArrayList(); TimeCalibration = new ArrayList(); Acceptance = false; close = false; InitializeComponent(); Table = new System.Data.DataTable(); Table.Columns.Add("WaresNumber", typeof(string)); Table.Columns.Add("DiagnosticsTime", typeof(decimal)); Table.Columns.Add("CalibrationTime", typeof(decimal)); Table.Columns.Add("CalibrationProtocol", typeof(string)); Table.Columns.Add("CalibrationCertificate", typeof(string)); Table.Columns.Add("CalibrationProtocolID", typeof(string)); Table.Columns.Add("CalibrationCertificateID", typeof(string)); Table.Columns.Add("WaresNumberID", typeof(string)); object[] Parametr = new object[8]; for (int i = 0; i < Table_AdditionalWaresList.RowCount; i++) { Parametr[0] = Table_AdditionalWaresList[i][RefServiceCard.AdditionalWaresList.WaresNumber]; Parametr[1] = Table_AdditionalWaresList[i][RefServiceCard.AdditionalWaresList.DiagnosticsTime]; Parametr[2] = Table_AdditionalWaresList[i][RefServiceCard.AdditionalWaresList.CalibrationTime]; Parametr[3] = Table_AdditionalWaresList[i][RefServiceCard.AdditionalWaresList.CalibrationProtocol] == null ? "" : Card.CardScript.Session.CardManager.GetCardData(Table_AdditionalWaresList[i][RefServiceCard.AdditionalWaresList.CalibrationProtocol].ToGuid()).Description; Parametr[4] = Table_AdditionalWaresList[i][RefServiceCard.AdditionalWaresList.CalibrationCertificate] == null ? "" : Card.CardScript.Session.CardManager.GetCardData(Table_AdditionalWaresList[i][RefServiceCard.AdditionalWaresList.CalibrationCertificate].ToGuid()).Description; Parametr[5] = Table_AdditionalWaresList[i][RefServiceCard.AdditionalWaresList.CalibrationProtocol] == null ? "" : Table_AdditionalWaresList[i][RefServiceCard.AdditionalWaresList.CalibrationProtocol].ToString(); Parametr[6] = Table_AdditionalWaresList[i][RefServiceCard.AdditionalWaresList.CalibrationCertificate] == null ? "" : Table_AdditionalWaresList[i][RefServiceCard.AdditionalWaresList.CalibrationCertificate].ToString(); Parametr[7] = Table_AdditionalWaresList[i][RefServiceCard.AdditionalWaresList.WaresNumberID].ToString(); Table.Rows.Add(Parametr); } gridControl1.DataSource = Table; }
/// <summary> /// Позиция калькуляции стоимости сервисного обслуживания /// </summary> public CalculationItem(MyBaseCard Card, string DeviceName, string DeviceID, string BlockName, string BlockID, string WorkName, string WorkID, bool Improvement, int Count, bool Include, bool VoidWarranty, bool DoubleCost, string DescriptionOfReason, bool RefusalToRepair) { this.DeviceName = DeviceName; this.DeviceID = DeviceID; this.BlockName = BlockName; this.BlockID = BlockID; this.WorkName = WorkName; this.WorkID = WorkID; this.Improvement = Improvement; this.VoidWarranty = VoidWarranty; this.DoubleCost = DoubleCost; this.DescriptionOfReason = DescriptionOfReason; this.RefusalToRepair = RefusalToRepair; switch (this.WorkName) { case "": this.Price = 0; break; case "Доставка до СКБ": this.Price = Card.GetControlValue(RefApplicationCard.MainInfo.DeliveryCost) == null ? 0 : (decimal)Card.GetControlValue(RefApplicationCard.MainInfo.DeliveryCost); break; default: if (this.WorkID != "") { this.Price = Convert.ToDecimal(ApplicationCard.UniversalCard.GetItemPropertyValue(new Guid(WorkID), "Стоимость (руб/шт)")); } break; } //this.Price = this.WorkID != "" ? Convert.ToDecimal(ApplicationCard.UniversalCard.GetItemPropertyValue(new Guid(WorkID), "Стоимость (руб/шт)")) : 0; this.Count = Count; this.Cost = Price * Count; this.Include = Include; }
/// <summary> /// Создание формы "Перечень приборов". /// </summary> /// <param name="UniversalCard"> Карточка универсального справочника.</param> /// <param name="Devices"> Перечень приборов.</param> public DeviceList(MyBaseCard Card, CardData UniversalCard, ArrayList Devices) { this.Devices = Devices; this.UniversalCard = UniversalCard; InitializeComponent(); Table = new System.Data.DataTable(); Table.Columns.Add("DeviceType", typeof(string)); Table.Columns.Add("DeviceNumber", typeof(string)); Table.Columns.Add("DevicePassport", typeof(string)); object[] Parametr = new object[3]; foreach (string Row in Devices) { string DeviceType = ""; string DeviceNumber = ""; if (Row.ToString() == "") { DeviceType = Card.GetControlValue(RefServiceCard.MainInfo.DeviceType).ToString(); DeviceNumber = UniversalCard.GetItemName(new Guid(DeviceType)); } else { CardData DeviceCard = Card.CardScript.Session.CardManager.GetCardData(new Guid(Row.ToString())); DeviceType = CalibrationDocs.CalibrationLib.GetDeviceTypeID(DeviceCard); DeviceNumber = UniversalCard.GetItemName(new Guid(DeviceType)) + " " + CalibrationDocs.CalibrationLib.GetDeviceNumber(DeviceCard); } Parametr[0] = DeviceType; Parametr[1] = DeviceNumber; Parametr[2] = Row.ToString(); Table.Rows.Add(Parametr); } gridControl1.DataSource = Table; }
/// <summary> /// Форма описания неисправностей. /// </summary> public RepairsAndImprovements(MyBaseCard Card, CardData UniversalCard, string DeviceID, string DeviceNumber, string pDeviceType, string pBlockID, string pKindID, string pDescription, string pWayToSolve, string pComments, ArrayList pWorks, string pReplacementID = "", string pOldValueAction = "") { this.Card = Card; this.DeviceType = pDeviceType; this.DeviceID = DeviceID; this.DeviceNumber = DeviceNumber; this.InitializeComponent(); this.BlockID = pBlockID; this.Block = BlockID == "" ? "" : UniversalCard.GetItemName(pBlockID.ToGuid()); this.KindID = pKindID; this.Kind = KindID == "" ? "" : UniversalCard.GetItemName(pKindID.ToGuid()); this.Description = pDescription; this.WayToSolve = pWayToSolve; this.Comments = pComments; this.Works = pWorks; this.UniversalCard = UniversalCard; this.ReplacementID = pReplacementID; this.Replacement = pReplacementID == "" ? "" : Card.CardScript.Session.CardManager.GetCardData(new Guid(pReplacementID)).Description; this.OldProductAction = pOldValueAction; this.TBlock.Text = Block; this.TKind.Text = Kind; this.TDescription.Text = Description; this.TWayToSolve.Text = WayToSolve; this.TComments.Text = Comments; this.TReplacement.Text = Replacement; this.TOldProductAction.EditValue = OldProductAction; Guid SalesManagerID = Card.GetControlValue(RefServiceCard.MainInfo.Manager).ToGuid(); if (SalesManagerID.Equals(Card.Context.GetObjectRef(Card.Context.GetCurrentEmployee()).Id) || (bool)Card.CardScript.Session.Properties["IsAdmin"].Value || Card.Context.GetObjectRef(GetEmployeeByGroup(Card.Context, RefApplicationCard.Roles.ServiceManagerGroup)).Id.Equals(Card.Context.GetObjectRef(Card.Context.GetCurrentEmployee()).Id)) { this.TResult.OptionsColumn.ReadOnly = false; foreach (Work Row in Works) { int WorksType = (int)UniversalCard.GetItemPropertyValue(new Guid(Row.WorkID), "Тип работ"); if ((WorksType == 4)) // && (Row.Result == Work.NegotiationResult.Perform.GetDescription())) { this.TReplacement.Properties.ReadOnly = false; this.TOldProductAction.Properties.ReadOnly = false; } } } this.Text = this.Text + " " + DeviceNumber; Table = new System.Data.DataTable(); Table.Columns.Add("TW"); Table.Columns.Add("TWID"); Table.Columns.Add("TC", typeof(int)); Table.Columns.Add("TI", typeof(bool)); Table.Columns.Add("TP", typeof(string)); Table.Columns.Add("TPID", typeof(string)); Table.Columns.Add("TL", typeof(decimal)); Table.Columns.Add("TED", typeof(DateTime)); Table.Columns.Add("TR", typeof(string)); object[] Parametr = new object[9]; foreach (Work Row in Works) { Parametr[0] = Row.WorkName; Parametr[1] = Row.WorkID; Parametr[2] = Row.Count; Parametr[3] = Row.Improvements; Parametr[4] = Row.Performer; Parametr[5] = Row.PerformerID; Parametr[6] = Row.FactLaboriousness; if (Row.EndDate != null) { Parametr[7] = (DateTime)Row.EndDate; } Parametr[8] = Row.Result; Table.Rows.Add(Parametr); } gridControl1.DataSource = Table; }
/// <summary> /// Создание формы "Калькуляция стоимости сервисного обслуживания". /// </summary> /// <param name="Card"> Карточка заявки на сервисное обслуживание.</param> /// <param name="NDS"> Ставка НДС.</param> /// <param name="ProtocolID"> ID бланка калькуляции.</param> /// <param name="Calculation"> Данные калькуляции стоимости сервисного обслуживания.</param> public CalculationsForm(MyBaseCard Card, decimal NDS, Guid ProtocolID, ArrayList Calculation) { this.Card = Card; InitializeComponent(); this.NDS = NDS != 0 ? NDS : Cards.ApplicationCard.GetNDS(); this.ProtocolID = ProtocolID; string Comment = ""; TableItems = new System.Data.DataTable(); TableItems.Columns.Add("DeviceName"); TableItems.Columns.Add("BlockName"); TableItems.Columns.Add("WorkName"); TableItems.Columns.Add("Improvements", typeof(bool)); TableItems.Columns.Add("Price", typeof(decimal)); TableItems.Columns.Add("Count", typeof(int)); TableItems.Columns.Add("Cost", typeof(decimal)); TableItems.Columns.Add("Include", typeof(bool)); TableItems.Columns.Add("Comment"); object[] NewItem = new object[9]; foreach (CalculationItem Item in Calculation) { NewItem[0] = Item.DeviceName; NewItem[1] = Item.BlockName; NewItem[2] = Item.WorkName; NewItem[3] = Item.Improvement; NewItem[4] = Item.Price; NewItem[5] = Item.Count; NewItem[6] = Item.Cost; NewItem[7] = Item.Include; Comment = ""; if (Item.VoidWarranty) { Comment = "Гарантия аннулирована! Причина: " + Item.DescriptionOfReason; } if (Item.DoubleCost) { Comment = "Удвоена стоимость ремонта! Причина: " + Item.DescriptionOfReason; } if (Item.RefusalToRepair) { Comment = Comment == "" ? "Отказ от ремонта!" : Comment + " Отказ от ремонта!"; } NewItem[8] = Comment; TableItems.Rows.Add(NewItem); FullSum = FullSum + (decimal)Item.Cost; if (Item.Include) { Sum = Sum + (decimal)Item.Cost; } } CalculationGridControl.DataSource = TableItems; SumWithNDS = Sum * (1 + NDS / 100); FullSumWithNDS = FullSum * (1 + NDS / 100); this.NDS_Value.EditValue = NDS; this.CostWithoutNDS_Value.Value = Math.Round(Sum, 2); this.CostWithNDS_Value.Value = Math.Round(SumWithNDS, 2); this.CostNDS_Value.Value = Math.Round(Sum * (NDS / 100), 2); this.FullCostWithoutNDS_Value.Value = Math.Round(FullSum, 2); this.FullCostWithNDS_Value.Value = Math.Round(FullSumWithNDS, 2); this.FullCostNDS_Value.Value = Math.Round(FullSum * (NDS / 100), 2); if (ProtocolID != null) { this.CalculationFile_Value.Text = Card.CardScript.Session.CardManager.GetCardData(ProtocolID).Description; } }
/// <summary> /// Новый прибор. /// </summary> public Device(MyBaseCard Card, string DNID, string DTID, bool OA, bool R, bool C, bool V, bool WR, string A, string Com, string PL, bool W, string S, string WO) { this.Card = Card; DeviceItemID = DNID; if (OA == false) { DevicePassportID = DNID == "" ? "" : ApplicationCard.UniversalCard.GetItemPropertyValue(DNID.ToGuid(), "Паспорт прибора").ToString(); DeviceNumber = DNID == "" ? "" : ApplicationCard.UniversalCard.GetItemName(DNID.ToGuid()); ShortDeviceNumber = DNID == "" ? "" : ApplicationCard.UniversalCard.GetItemPropertyValue(DNID.ToGuid(), "Номер прибора").ToString(); string Year = DNID == "" ? "" : ApplicationCard.UniversalCard.GetItemPropertyValue(DNID.ToGuid(), "Год прибора").ToString(); ShortDeviceNumber = ShortDeviceNumber.Length == 4 ? ShortDeviceNumber : ShortDeviceNumber + "/" + Year; RowData SpecConditions = Card.CardScript.Session.CardManager.GetCardData(new Guid(DevicePassportID)).Sections[CardOrd.Properties.ID].FindRow("@Name = 'Особые условия по СО и ГО'"); SpecialConditions = SpecConditions.GetString("Value") != null?SpecConditions.GetString("Value") : ""; } else { DevicePassportID = ""; DeviceNumber = ""; } DeviceTypeID = DTID == "" ? "" : DTID; DeviceType = DTID == "" ? "" : ApplicationCard.UniversalCard.GetItemName(DTID.ToGuid()); OnlyAccessories = OA; Repair = R; Calibrate = C; Verify = V; WarrantyRepair = WR; Wash = W; Accessories = A == "" ? "" : A; Comments = Com == "" ? "" : Com; Services = FormattingService(this.Repair, this.Calibrate, this.Verify); PackedListData = PL == "" ? "" : PL; PackedListID = ""; Sensors = S == "" ? "" : S; ServiceCardID = WO; DeviceName = this.DeviceNumber == "" ? "Комплектующие для " + this.DeviceType : this.DeviceType + " №" + this.ShortDeviceNumber; if (Sensors != "") { List <String> SelectedSensors = Sensors.Split(';').Where(s => !String.IsNullOrEmpty(s.Trim())).ToList(); for (Int32 j = 0; j < SelectedSensors.Count; j++) { String[] Sensor = SelectedSensors[j].Trim().Split(' '); if (Sensor.Length >= 2) { RowData CurrentDeviceRow = GetDeviceRow(Sensor[1], Sensor[0]); string CurrentPassportId = CurrentDeviceRow.ChildSections[0].FindRow("@Name = 'Паспорт прибора'").GetString("Value"); string CurrentDeviceTypeID = CurrentDeviceRow.ChildSections[0].FindRow("@Name = 'Наименование прибора'").GetString("Value"); string CurrentDeviceTypeName = ApplicationCard.UniversalCard.GetItemName(CurrentDeviceTypeID); AdditionalWare NewWare = new AdditionalWare(Card.CardScript, SelectedSensors[j], CurrentPassportId, CurrentDeviceRow.Id.ToString(), CurrentDeviceTypeID, CurrentDeviceTypeName); AdditionalWaresList.Add(NewWare); } } } if (ServiceCardID != "") { CardData ServiceCard = Card.CardScript.Session.CardManager.GetCardData(new Guid(ServiceCardID)); RowData Adjustment = ServiceCard.Sections[RefServiceCard.Adjustment.ID].FirstRow; RowData MainInfo = ServiceCard.Sections[RefServiceCard.MainInfo.ID].FirstRow; this.VoidWarranty = Adjustment.GetBoolean(RefServiceCard.Adjustment.VoidWarranty) == null ? false : (bool)Adjustment.GetBoolean(RefServiceCard.Adjustment.VoidWarranty); this.DoubleCost = Adjustment.GetBoolean(RefServiceCard.Adjustment.DoubleCost) == null ? false : (bool)Adjustment.GetBoolean(RefServiceCard.Adjustment.DoubleCost); this.DescriptionOfReason = Adjustment.GetString(RefServiceCard.Adjustment.DescriptionOfReason) == null ? "" : Adjustment.GetString(RefServiceCard.Adjustment.DescriptionOfReason).ToString(); this.RefusalToRepair = (int)MainInfo.GetInt32(RefServiceCard.MainInfo.Status) == (int)RefServiceCard.MainInfo.State.Failure ? true : false; } }