Example #1
0
        /// <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;
        }
Example #2
0
        /// <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;
        }
Example #3
0
        /// <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;
        }