private void mtxRefound_ClickBefore(object sboObject, SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;
            try
            {
                if (pVal.Row > 0)
                {
                    mtxRefound.SelectRow(pVal.Row, true, false);
                    mIntRowSelected = pVal.Row;

                    int lIntRowStatus = Convert.ToInt32(DtMatrix.GetValue("C_Status", mIntRowSelected - 1).ToString());
                    if (lIntRowStatus == 4)
                    {
                        ShowControlsPayment();
                    }
                    else
                    {
                        HiddecontrolsPayments();
                    }
                }
            }
            catch (Exception ex)
            {
                LogService.WriteError("frmSearchRefunds (mtxRefound_ClickBefore) " + ex.Message);
                LogService.WriteError(ex);
            }
        }
        private void ToCommonState(VcTime focuseTime)
        {
            EnLsnAct         Act = null;
            DtMatrix <eRule> rles
                = VC2WinFmApp.Engine.GetSqdRule(this.squad);

            foreach (SqdScheduleCell cell in Matrix.eachCell())
            {
                if (cell.Time == focuseTime)
                {
                    cell.CellState = eCellState.focused;
                    Act            = cell.Act;
                }
                else
                {
                    cell.CellState = eCellState.common;
                }

                cell.Rule = rles[cell.Time];
            }

            RenewRuleGrid(focuseTime);

            schState = eSchState.common;
            if (Act == null || Act.ClsLesson == null)
            {
                VC2WinFmApp.MessageSwitch.SetLastTch(null, null);
            }
            else
            {
                VC2WinFmApp.MessageSwitch.SetLastTch(Act.ClsLesson.Teacher, Act.Time);
            }
        }
Beispiel #3
0
        private void mtxCosts_ClickBefore(object sboObject, SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;
            try
            {
                if (pVal.Row > 0)
                {
                    mtxCosts.SelectRow(pVal.Row, true, false);
                    mIntRowSelected = pVal.Row;

                    decimal lIntRowPend = Convert.ToDecimal(DtMatrix.GetValue("C_SaldoPen", mIntRowSelected - 1).ToString());

                    int lIntRowStatus = Convert.ToInt32(DtMatrix.GetValue("C_Status", mIntRowSelected - 1).ToString());
                    if (lIntRowStatus == 4 && lIntRowPend < 0)
                    {
                        ShowControlsPayment();
                    }
                    else
                    {
                        HiddecontrolsPayments();
                    }
                }
            }
            catch (Exception ex)
            {
                UIApplication.ShowError(ex.Message);
                LogService.WriteError("(mtxCosts_ClickBefore): " + ex.Message);
                LogService.WriteError(ex);
            }
        }
Beispiel #4
0
        public void PrintMatrix(PrintDocument Doc, Graphics graphics, Rectangle rect)
        {
            Rectangle titleRect = new Rectangle(rect.Left, rect.Top + 20, rect.Width, 100);

            graphics.DrawString(squad.ToString(),
                                new Font("宋体", DrawComm.SuitFontSize((double)titleRect.Height * 1), FontStyle.Bold),
                                new SolidBrush(Color.Black), titleRect, DrawComm.CenterStringFormat);

            graphics.DrawString(ViewStyle.Description,
                                new Font("宋体", DrawComm.SuitFontSize((double)titleRect.Height * 0.5)),
                                new SolidBrush(Color.Black),
                                rect.Left, rect.Top + 100);

            FcMatrixPtr <PrtMatterCellSqd> Matrix = new FcMatrixPtr <PrtMatterCellSqd>(VC2WinFmApp.DataRule.Solution);

            Matrix.HeighWidthProportionLow  = 30;
            Matrix.HeighWidthProportionHigh = 80;
            DtMatrix <EnLsnAct> SqdMatrix = VC2WinFmApp.Engine.GetSqdMatrix(squad);

            foreach (VcTime time in SqdMatrix.eachTime())
            {
                if (SqdMatrix[time] != null)
                {
                    Matrix[time].Course = SqdMatrix[time].ClsLesson.Lesson.Course;
                }
            }

            Matrix.Rect = new Rectangle(rect.Left, rect.Top + 130, rect.Width, rect.Height - 130);
            Matrix.Draw(graphics);

            //todo  打印授课教师表格
        }
        private void ToInDropState(EnLsnAct Act, VcTime sTime)
        {
            DtMatrix <eRule> rles
                = VC2WinFmApp.Engine.GetActChangeRule(this.squad, Act, sTime);

            foreach (SqdScheduleCell cell in Matrix.eachCell())
            {
                //存在重复更新,为简化逻辑,不要管
                if (cell.Time == sTime)
                {
                    cell.CellState = eCellState.isDropSrc;
                }
                else if (cell.Act != null && cell.Act.ClsLesson == Act.ClsLesson)
                {
                    cell.CellState = eCellState.likeDropSrc;
                }
                else
                {
                    cell.CellState = eCellState.inDrop;
                    cell.Rule      = rles[cell.Time];
                }
            }

            RenewRuleGrid(sTime);
            sTime.CopyFieldTo(DropSrcTime);
            schState = eSchState.inDrop;  //进入拖放状态
            if (Act == null || Act.ClsLesson == null)
            {
                VC2WinFmApp.MessageSwitch.SetLastTch(null, null);
            }
            else
            {
                VC2WinFmApp.MessageSwitch.SetLastTch(Act.ClsLesson.Teacher, Act.Time);
            }
        }
Beispiel #6
0
        /// <summary>
        /// 获取教师课表
        /// </summary>
        public DtMatrix <IList <EnLsnAct> > GetTchMatrix(EnTeacher teacher)
        {
            DtMatrix <IList <EnLsnAct> > Result = new DtMatrix <IList <EnLsnAct> >(DataRule.Solution);

            foreach (SqdSchedule sch in SqdScheduleList.Values)
            {
                if (sch.Teaches.Contains(teacher))
                {
                    foreach (VcTime time in sch.Matrix.eachTime())
                    {
                        if (sch.Matrix[time].LsnAct != null &&
                            sch.Matrix[time].LsnAct.ClsLesson.Teacher == teacher)
                        {
                            if (Result[time] == null)
                            {
                                Result[time] = new List <EnLsnAct>();
                            }

                            Result[time].Add(sch.Matrix[time].LsnAct);
                        }
                    }
                }
            }

            return(Result);
        }
Beispiel #7
0
        /// <summary>
        /// 生成班级课表(SqdScheduleList),不会生成各节课的规则
        /// </summary>
        private void SetSqdScheduleListData()
        {
            TimeTestMatrix = new DtMatrix <bool>(DataRule.Solution);

            SqdScheduleList.Clear();

            foreach (EnLsnAct act in DataRule.Lsn.eachLsnAct())
            {
                SqdSchedule sqdSch;
                if (!SqdScheduleList.TryGetValue(act.ClsLesson.Squad, out sqdSch))
                {
                    sqdSch = new SqdSchedule(DataRule.Solution, act.ClsLesson.Squad);
                    SqdScheduleList.Add(act.ClsLesson.Squad, sqdSch);
                }
                sqdSch.FailLsnActs.Add(act);  //暂时存下
            }

            foreach (SqdSchedule sqdSch in SqdScheduleList.Values)
            {
                foreach (EnLsnAct act in sqdSch.FailLsnActs)
                {
                    if (act.ClsLesson.Teacher != null &&
                        !sqdSch.Teaches.Contains(act.ClsLesson.Teacher))
                    {
                        sqdSch.Teaches.Add(act.ClsLesson.Teacher);
                    }
                }

                PutActToMatrix(sqdSch);
            }
        }
Beispiel #8
0
        public void PrintMatrix(PrintDocument Doc, Graphics graphics, Rectangle rect)
        {
            Rectangle titleRect = new Rectangle(rect.Left, rect.Top + 20, rect.Width, 100);

            graphics.DrawString(teacher.ToString(),
                                new Font("���ו", DrawComm.SuitFontSize((double)titleRect.Height * 1), FontStyle.Bold),
                                new SolidBrush(Color.Black), titleRect, DrawComm.CenterStringFormat);

            graphics.DrawString(ViewStyle.Description,
                                new Font("���ו", DrawComm.SuitFontSize((double)titleRect.Height * 0.5)),
                                new SolidBrush(Color.Black),
                                rect.Left, rect.Top + 100);

            FcMatrixPtr <PrtMatterCellTch> Matrix = new FcMatrixPtr <PrtMatterCellTch>(VC2WinFmApp.DataRule.Solution);

            Matrix.HeighWidthProportionLow  = 30;
            Matrix.HeighWidthProportionHigh = 80;

            DtMatrix <IList <EnLsnAct> > TchMatrix = VC2WinFmApp.Engine.GetTchMatrix(teacher);

            foreach (VcTime time in TchMatrix.eachTime())
            {
                Matrix[time].Acts = TchMatrix[time];
            }

            Matrix.Rect = new Rectangle(rect.Left, rect.Top + 130, rect.Width, rect.Height - 130);
            Matrix.Draw(graphics);
        }
Beispiel #9
0
            public SqdSchedule(EnSolution Sln, EnSquad Squad)
            {
                this.squad = Squad;

                matrix = new DtMatrix <ScheduleNode>(Sln);
                foreach (VcTime time in matrix.eachTime())
                {
                    matrix[time] = new ScheduleNode();
                }
            }
Beispiel #10
0
        /// <summary>
        ///  获得当前虚拟态的课表(未保存的内存中的课表)
        /// </summary>
        public DtMatrix <EnLsnAct> GetSqdMatrix(EnSquad squad)
        {
            DtMatrix <EnLsnAct> Result = new DtMatrix <EnLsnAct>(DataRule.Solution);
            SqdSchedule         sch    = SqdScheduleList[squad];

            foreach (VcTime time in Result.eachTime())
            {
                Result[time] = sch.Matrix[time].LsnAct;
            }

            return(Result);
        }
        private static string[] GetMatrixStringArray(VCExportMatrix Matrix, BaseEntity entity)
        {
            String[] result = new String[VCExportMatrix.cFlatIdxLen];
            if (entity is EnTeacher)
            {
                DtMatrix <IList <EnLsnAct> > DtMatrix = VC2WinFmApp.Engine.GetTchMatrix(entity as EnTeacher);

                foreach (VcTime time in DtMatrix.eachTime())
                {
                    IList <EnLsnAct> acts = DtMatrix[time];
                    if (acts != null && acts.Count > 0)
                    {
                        MatrixCoordinate mc;
                        mc.Enabled = true;
                        mc.Week    = (Int32)time.Week;
                        mc.Section = (Int32)time.BetideNode;
                        mc.Idx     = time.Order - 1;
                        Int32  idx   = VCExportMatrix.MatrixCoordinateToFlat(mc);
                        String value = null;
                        foreach (EnLsnAct act in acts)
                        {
                            value = (String.IsNullOrEmpty(value) ? "" : value + "  ") + act.Squad + " " + act.ClsLesson.Lesson.Course.Name;
                        }

                        result[idx] = value;
                    }
                }
            }
            else if (entity is EnSquad)
            {
                DtMatrix <EnLsnAct> DtMatrix = VC2WinFmApp.Engine.GetSqdMatrix(entity as EnSquad);

                foreach (VcTime time in DtMatrix.eachTime())
                {
                    EnLsnAct act = DtMatrix[time];
                    if (act != null)
                    {
                        MatrixCoordinate mc;
                        mc.Enabled = true;
                        mc.Week    = (Int32)time.Week;
                        mc.Section = (Int32)time.BetideNode;
                        mc.Idx     = time.Order - 1;
                        Int32  idx   = VCExportMatrix.MatrixCoordinateToFlat(mc);
                        String value = act.ClsLesson.Lesson.Course.Name;

                        result[idx] = value;
                    }
                }
            }

            return(result);
        }
Beispiel #12
0
        /// <summary>
        /// 生成班级课表的规则,应用clsLsn的规则并标记出教师授课冲突
        /// </summary>
        private void SetSqdScheduleListRule()
        {
            //没课的单元格必须设为eRule.common
            foreach (SqdSchedule sqdSch in SqdScheduleList.Values)
            {
                foreach (ScheduleNode node in sqdSch.Matrix.eachElement())
                {
                    node.Rule = eRule.common;
                }
            }

            DtMatrix <Boolean>             Times        = new DtMatrix <bool>(DataRule.Solution);
            IDictionary <EnTeacher, Int32> TchsClsCount = new Dictionary <EnTeacher, Int32>();

            foreach (VcTime time in Times.eachTime())
            {
                TchsClsCount.Clear();
                foreach (ScheduleNode schNode in eachEnabledScheduleNode(time))
                {
                    EnClsLesson clsLsn = schNode.LsnAct.ClsLesson;
                    schNode.Rule = ClsLsnRuleList[clsLsn][time];   //程序逻辑正常则必定存在

                    if (clsLsn.Teacher != null)
                    {
                        if (TchsClsCount.ContainsKey(clsLsn.Teacher))
                        {
                            TchsClsCount[clsLsn.Teacher]++;
                        }
                        else
                        {
                            TchsClsCount.Add(clsLsn.Teacher, 1);
                        }
                    }
                }

                foreach (KeyValuePair <EnTeacher, Int32> pair in TchsClsCount)
                {
                    if (pair.Value > 1)
                    {
                        foreach (ScheduleNode schNode in eachEnabledScheduleNode(time))
                        {
                            if (schNode.LsnAct.ClsLesson.Teacher == pair.Key)
                            {
                                schNode.Rule = eRule.crisscross;
                            }
                        }
                    }
                }
            }
        }
        public void ScheduleUpdate(eScheduleUpdateKind Kind)
        {
            switch (Kind)
            {
            case eScheduleUpdateKind.RefreshMatrix:
                Matrix.Solution = VC2WinFmApp.DataRule.Solution;
                BindMatrixCellEvent();
                break;

            case eScheduleUpdateKind.RefreshAct:
                DtMatrix <IList <EnLsnAct> > mtx
                    = VC2WinFmApp.Engine.GetTchMatrix(this.teacher);

                foreach (VcTime time in mtx.eachTime())
                {
                    Matrix[time].Acts = mtx[time];
                }

                break;

            case eScheduleUpdateKind.RefreshRule:
                foreach (TchScheduleCell cell in Matrix.eachCell())
                {
                    cell.Rule = eRule.common;
                }


                DtMatrix <Boolean> SlnMatrix
                    = new DtMatrix <bool>(VC2WinFmApp.DataRule.Solution);
                IList <VcRuleCell> rules = VC2WinFmApp.DataRule.Rule.GetRules(this.teacher);
                foreach (VcRuleCell rls in rules)
                {
                    if (SlnMatrix.TestTime(rls.Time))
                    {
                        Matrix[rls.Time].Rule = rls.Rule;
                    }
                }

                break;

            case eScheduleUpdateKind.Invalidate:
                if (!VC2WinFmApp.Engine.EntityIsEnabled(this.teacher))
                {
                    Close();
                }
                break;
            }
        }
        private void FillMatrix(List <Vouchers> pLstVouchers)
        {
            try
            {
                int i = 0;
                this.UIAPIRawForm.Freeze(true);
                foreach (Vouchers lObjVoucher in pLstVouchers)
                {
                    DtMatrix.Rows.Add();
                    DtMatrix.SetValue("#", i, i + 1);
                    DtMatrix.SetValue("C_RowCode", i, lObjVoucher.RowCode);
                    DtMatrix.SetValue("C_Folio", i, lObjVoucher.Folio);
                    DtMatrix.SetValue("C_Status", i, lObjVoucher.Status);
                    DtMatrix.SetValue("C_StatusDescription", i, ((StatusEnum)lObjVoucher.Status).GetDescription());
                    DtMatrix.SetValue("C_Area", i, lObjVoucher.Area);
                    DtMatrix.SetValue("C_Employe", i, lObjVoucher.Employee);
                    DtMatrix.SetValue("C_Date", i, lObjVoucher.Date);
                    DtMatrix.SetValue("C_Amount", i, lObjVoucher.Total);
                    i++;
                }

                mtxRefound.Columns.Item("#").DataBind.Bind("DsVouchers", "#");
                mtxRefound.Columns.Item("C_Folio").DataBind.Bind("DsVouchers", "C_Folio");
                mtxRefound.Columns.Item("C_Status").DataBind.Bind("DsVouchers", "C_StatusDescription");
                mtxRefound.Columns.Item("C_Area").DataBind.Bind("DsVouchers", "C_Area");
                mtxRefound.Columns.Item("C_Employe").DataBind.Bind("DsVouchers", "C_Employe");
                mtxRefound.Columns.Item("C_Date").DataBind.Bind("DsVouchers", "C_Date");
                mtxRefound.Columns.Item("C_Amount").DataBind.Bind("DsVouchers", "C_Amount");
                mtxRefound.LoadFromDataSource();
                mtxRefound.AutoResizeColumns();
                this.UIAPIRawForm.Freeze(false);
            }
            catch (Exception ex)
            {
                this.UIAPIRawForm.Freeze(false);
                UIApplication.ShowMessageBox(ex.Message);
                LogService.WriteError("frmSearchRefunds (frmPurchaseNotes) " + ex.Message);
                LogService.WriteError(ex);
            }
            finally
            {
                this.UIAPIRawForm.Freeze(false);
            }
        }
Beispiel #15
0
        /// <summary>
        ///  获得当前虚拟态的课表规则
        /// </summary>
        public DtMatrix <eRule> GetSqdRule(EnSquad squad)
        {
            DtMatrix <eRule> Result
                = new DtMatrix <eRule>(DataRule.Solution);
            SqdSchedule sch = SqdScheduleList[squad];

            foreach (VcTime time in Result.eachTime())
            {
                if (sch.Matrix[time].LsnAct == null)
                {
                    Result[time] = eRule.common;
                }
                else
                {
                    Result[time] = sch.Matrix[time].Rule;
                }
            }
            return(Result);
        }
        public void RefreshAct()
        {
            var oldCount    = TaskGridBind.Count;
            var oldPosition = TaskGridBind.Position;

            this.TaskGridBind.Binding(VC2WinFmApp.Engine.GetFailLsnActs(this.squad));
            if (TaskGridBind.Count == oldCount - 1)
            {
                oldPosition = oldPosition - 1;
            }
            this.TaskGridBind.Position = oldPosition;

            DtMatrix <EnLsnAct> mtx
                = VC2WinFmApp.Engine.GetSqdMatrix(this.squad);

            foreach (VcTime time in mtx.eachTime())
            {
                Matrix[time].Act = mtx[time];
            }
        }
        public void RefreshRule()
        {
            DtMatrix <eRule> rles
                = VC2WinFmApp.Engine.GetSqdRule(this.squad);

            foreach (VcTime time in rles.eachTime())
            {
                Matrix[time].Rule = rles[time];
            }

            VcTime focuseTime = new VcTime();

            foreach (SqdScheduleCell cell in Matrix.eachCell())
            {
                if (cell.CellState == eCellState.focused)
                {
                    cell.Time.CopyFieldTo(focuseTime);
                }
            }

            RenewRuleGrid(focuseTime);
        }
 private void LoadFormReceipts()
 {
     try
     {
         if (mIntRowSelected > 0)
         {
             string      pStrRowCode     = DtMatrix.GetValue("C_RowCode", mIntRowSelected - 1).ToString();
             frmReceipts lObjfrmReceipts = new frmReceipts(pStrRowCode, TypeEnum.Type.Refund);
             lObjfrmReceipts.UIAPIRawForm.Left = 500;
             lObjfrmReceipts.Show();
         }
         else
         {
             UIApplication.ShowMessageBox("Favor de seleccionar un registro");
         }
     }
     catch (Exception ex)
     {
         LogService.WriteError("frmSearchRefunds (btnReview_ClickBefore) " + ex.Message);
         LogService.WriteError(ex);
     }
 }
Beispiel #19
0
        /// <summary>
        /// 生成ClsLesson的规则表(ClsLsnRuleList)
        /// </summary>
        private void SetClsLsnRuleList()
        {
            ClsLsnRuleList.Clear();

            foreach (EnClsLesson clsLsn in DataRule.Lsn.eachClsLesson())
            {
                DtMatrix <eRule> clsLsnRules
                    = new DtMatrix <eRule>(DataRule.Solution);
                ClsLsnRuleList.Add(clsLsn, clsLsnRules);

                foreach (VcRuleCell rt in DataRule.Rule.GetRules(clsLsn))
                {
                    if (clsLsnRules.TestTime(rt.Time))
                    {
                        clsLsnRules[rt.Time] = VcTimeLogic.RuleAdd(clsLsnRules[rt.Time], rt.Rule);
                    }
                }
                foreach (VcRuleCell rt in DataRule.Rule.GetRules(clsLsn.Lesson))
                {
                    if (clsLsnRules.TestTime(rt.Time))
                    {
                        clsLsnRules[rt.Time] = VcTimeLogic.RuleAdd(clsLsnRules[rt.Time], rt.Rule);
                    }
                }

                foreach (BaseEntity ety in eachClsLsnComponent(clsLsn))
                {
                    foreach (VcRuleCell rt in DataRule.Rule.GetRules(ety))
                    {
                        if (clsLsnRules.TestTime(rt.Time))
                        {
                            clsLsnRules[rt.Time] = VcTimeLogic.RuleAdd(clsLsnRules[rt.Time], rt.Rule);
                        }
                    }
                }
            }
        }
Beispiel #20
0
        protected void CreateMattes()
        {
            mattes = new DtMatrix <MatterCell>(solution);
            foreach (VcTime time in mattes.eachTime())
            {
                MatterCell cl = this.GetNewMatterCell();
                time.CopyFieldTo(cl.Time);

                mattes[time] = cl;
            }

            ClmCount = 1;
            RowCount = cRate;
            BorderDirect bd0 = new BorderDirect();

            bd0.Border = this.GetNewBorderCell();
            bd0.Clm    = ClmCount - 1;
            bd0.Row    = 0;
            bd0.Wdh    = 1;
            bd0.Hgh    = cRate;

            TopBordes[0] = bd0;
            for (Int32 i = 0; i < 7; i++)
            {
                if (solution.ActiveWeekArr[i])
                {
                    ClmCount++;
                    BorderDirect bd = new BorderDirect();
                    bd.Border      = this.GetNewBorderCell();
                    bd.Border.Text = ExDateTime.DayOfWeekToChiese((DayOfWeek)i, "周");
                    bd.Clm         = ClmCount - 1;
                    bd.Row         = 0;
                    bd.Wdh         = 1;
                    bd.Hgh         = cRate;

                    TopBordes[i + 1] = bd;
                }
            }

            Boolean IsOpening = false;

            for (Int32 i = 0; i < 4; i++)
            {
                if (solution.LessonNumberArr[i] > 0)
                {
                    if (IsOpening)
                    {
                        BorderDirect bd = new BorderDirect();
                        bd.Border = this.GetNewBorderCell();
                        bd.Clm    = 0;
                        bd.Row    = RowCount;
                        bd.Wdh    = ClmCount;
                        bd.Hgh    = 1;

                        LeftBordes[i, 0] = bd;
                        RowCount         = RowCount + 1;
                    }
                    for (Int32 j = 1; j <= solution.LessonNumberArr[i]; j++)
                    {
                        BorderDirect bd = new BorderDirect();
                        bd.Border      = this.GetNewBorderCell();
                        bd.Border.Text = j == 1 ?
                                         VcTimeLogic.BetideNodeToString((eBetideNode)i) + " " + (j)
                            : j.ToString();
                        bd.Clm = 0;
                        bd.Row = RowCount;
                        bd.Wdh = 1;
                        bd.Hgh = cRate;

                        LeftBordes[i, j] = bd;
                        RowCount         = RowCount + cRate;
                    }
                    IsOpening = true;
                }
            }
        }
Beispiel #21
0
        private void FillMatrix()
        {
            try
            {
                this.UIAPIRawForm.Freeze(true);
                if (DtMatrix != null)
                {
                    DtMatrix.Rows.Clear();
                }
                List <PaymentDTO> lLstPaymentDTO = mObjPurchasesServiceFactory.GetPurchaseCheeckingCostService().GetPayment(txtArea.Value, cboStatus.Value).ToList();

                int i = 0;

                foreach (PaymentDTO lObjPaymentDTO in lLstPaymentDTO)
                {
                    DtMatrix.Rows.Add();
                    DtMatrix.SetValue("#", i, i + 1);

                    /*DtMatrix.SetValue("C_DocEntry", i, lObjPaymentDTO.DocEntry);
                     * DtMatrix.SetValue("C_DocNum", i, lObjPaymentDTO.DocNum);*/
                    DtMatrix.SetValue("C_Folio", i, lObjPaymentDTO.Folio);
                    string lStrStatus = "";
                    if (lObjPaymentDTO.Status == "0" || lObjPaymentDTO.Status == "")
                    {
                        lStrStatus = "";
                    }
                    else
                    {
                        StatusEnum lObjStatusEnum = (StatusEnum)Convert.ToInt16(lObjPaymentDTO.Status);
                        lStrStatus = lObjStatusEnum.GetDescription();
                    }

                    DtMatrix.SetValue("C_Status", i, lObjPaymentDTO.Status);

                    int lIntStatus = 0;
                    if (int.TryParse(lObjPaymentDTO.Status, out lIntStatus))
                    {
                        lIntStatus = Convert.ToInt32(lObjPaymentDTO.Status);
                    }

                    DtMatrix.SetValue("C_Status", i, lIntStatus.ToString());
                    DtMatrix.SetValue("C_StatusDescription", i, lStrStatus);
                    DtMatrix.SetValue("C_EmpId", i, lObjPaymentDTO.EmpId);
                    DtMatrix.SetValue("C_Employe", i, lObjPaymentDTO.Employee);
                    DtMatrix.SetValue("C_Area", i, lObjPaymentDTO.Area);
                    // DtMatrix.SetValue("C_Date", i, Convert.ToDateTime(lObjPaymentDTO.Date));
                    DtMatrix.SetValue("C_ImpSol", i, lObjPaymentDTO.ImpSol);
                    DtMatrix.SetValue("C_ImpComp", i, lObjPaymentDTO.ImpComp);
                    DtMatrix.SetValue("C_ImpFalt", i, lObjPaymentDTO.ImpFalt);
                    DtMatrix.SetValue("C_ImpSob", i, lObjPaymentDTO.ImpSob);
                    DtMatrix.SetValue("C_SaldoPen", i, lObjPaymentDTO.SaldoPen);
                    i++;
                }

                mtxCosts.Columns.Item("#").DataBind.Bind("PaymentsDataTable", "#");
                mtxCosts.Columns.Item("C_Folio").DataBind.Bind("PaymentsDataTable", "C_Folio");
                //mtxCosts.Columns.Item("C_DocEntry").DataBind.Bind("PaymentsDataTable", "C_DocNum");
                mtxCosts.Columns.Item("C_Status").DataBind.Bind("PaymentsDataTable", "C_StatusDescription");
                mtxCosts.Columns.Item("C_Employe").DataBind.Bind("PaymentsDataTable", "C_Employe");
                mtxCosts.Columns.Item("C_Area").DataBind.Bind("PaymentsDataTable", "C_Area");
                //mtxCosts.Columns.Item("C_Date").DataBind.Bind("PaymentsDataTable", "C_Date");
                mtxCosts.Columns.Item("C_ImpSol").DataBind.Bind("PaymentsDataTable", "C_ImpSol");
                mtxCosts.Columns.Item("C_ImpComp").DataBind.Bind("PaymentsDataTable", "C_ImpComp");
                mtxCosts.Columns.Item("C_ImpFalt").DataBind.Bind("PaymentsDataTable", "C_ImpFalt");
                mtxCosts.Columns.Item("C_ImpSob").DataBind.Bind("PaymentsDataTable", "C_ImpSob");
                mtxCosts.Columns.Item("C_SaldoPen").DataBind.Bind("PaymentsDataTable", "C_SaldoPen");


                mtxCosts.LoadFromDataSource();
                mtxCosts.AutoResizeColumns();
                this.UIAPIRawForm.Freeze(false);
                LogService.WriteInfo("(frmCheckingCost) Matriz Cargada correctamente: Area " + txtArea.Value + ", Estatus " + cboStatus.Value);
            }
            catch (Exception ex)
            {
                this.UIAPIRawForm.Freeze(false);
                UIApplication.ShowMessageBox(ex.Message);
                LogService.WriteError("(FillMatrix): " + ex.Message);
                LogService.WriteError(ex);
            }
            finally
            {
                this.UIAPIRawForm.Freeze(false);
            }
        }
Beispiel #22
0
        public void ScheduleUpdate(eScheduleUpdateKind Kind)
        {
            switch (Kind)
            {
            case eScheduleUpdateKind.RefreshMatrix:
                MatrixLast.Solution  = VC2WinFmApp.DataRule.Solution;
                MatrixFocus.Solution = VC2WinFmApp.DataRule.Solution;
                break;

            //特别的响应,即使RefreshRule也要更新课表,为处理调课完成后
            case eScheduleUpdateKind.RefreshAct:
                var mtxLast  = VC2WinFmApp.Engine.GetTchMatrix(this._LastTch);
                var mtxFocus = VC2WinFmApp.Engine.GetTchMatrix(this._FocusTch);

                foreach (VcTime time in mtxLast.eachTime())
                {
                    MatrixLast[time].Acts  = mtxLast[time];
                    MatrixFocus[time].Acts = mtxFocus[time];
                }
                break;

            case eScheduleUpdateKind.RefreshRule:
                foreach (TchScheduleCell cell in MatrixLast.eachCell())
                {
                    cell.Rule = eRule.common;
                }
                foreach (TchScheduleCell cell in MatrixFocus.eachCell())
                {
                    cell.Rule = eRule.common;
                }


                var SlnMatrix = new DtMatrix <bool>(VC2WinFmApp.DataRule.Solution);
                var ruleS     = VC2WinFmApp.DataRule.Rule.GetRules(this._LastTch);
                var ruleT     = VC2WinFmApp.DataRule.Rule.GetRules(this._FocusTch);
                foreach (var rls in ruleS)
                {
                    if (SlnMatrix.TestTime(rls.Time))
                    {
                        MatrixLast[rls.Time].Rule = rls.Rule;
                    }
                }
                foreach (var rls in ruleT)
                {
                    if (SlnMatrix.TestTime(rls.Time))
                    {
                        MatrixFocus[rls.Time].Rule = rls.Rule;
                    }
                }

                break;

            case eScheduleUpdateKind.Invalidate:
                if (_LastTch != null && !VC2WinFmApp.Engine.EntityIsEnabled(_LastTch))
                {
                    LastTch = null;
                }
                if (_FocusTch != null && !VC2WinFmApp.Engine.EntityIsEnabled(_FocusTch))
                {
                    FocusTch = null;
                }

                break;
            }
        }
Beispiel #23
0
        /// <summary>
        /// 获取交换时优势
        /// </summary>
        public DtMatrix <eRule> GetActChangeRule(EnSquad squad,
                                                 EnLsnAct sAct, VcTime sTime)
        {
            Debug.Assert(sAct != null, "为简化程序逻辑,空课不可拖。");

            //这个方法是本程序中最复杂的逻辑
            //步骤:
            //一、获得所有位置当前优势
            //二、获得sAct当前优势
            //三、获得所有位置的Act移动到sTime的优势值
            //四、获得sAct移动到所有位置的优势值
            //五、比较当前优势和移动后的优势,获得交换的价值

            SqdSchedule NowSch = SqdScheduleList[squad];

            //一、获得所有位置当前优势
            DtMatrix <eRule> NowRules = this.GetSqdRule(squad);

            //二、获得sAct当前优势
            eRule sActNowRule;

            if (NowRules.TestTime(sTime))
            {
                sActNowRule = NowRules[sTime];
            }
            else
            {
                sActNowRule = eRule.common;  //未排
            }
            //三、获得所有位置的Act移动到sTime的优势值
            DtMatrix <eRule> FutureRules = new DtMatrix <eRule>(DataRule.Solution);

            if (FutureRules.TestTime(sTime))
            {
                IList <EnTeacher> sTimeTchs = new List <EnTeacher>();
                foreach (SqdSchedule sch in this.SqdScheduleList.Values)
                {
                    if (sch != NowSch && sch.Matrix[sTime].LsnAct != null)
                    {
                        EnLsnAct act = sch.Matrix[sTime].LsnAct;
                        if (act.ClsLesson.Teacher != null &&
                            !sTimeTchs.Contains(act.ClsLesson.Teacher))
                        {
                            sTimeTchs.Add(act.ClsLesson.Teacher);
                        }
                    }
                }

                foreach (VcTime time in FutureRules.eachTime())
                {
                    if (NowSch.Matrix[time].LsnAct != null)
                    {
                        EnLsnAct act = NowSch.Matrix[time].LsnAct;
                        if (act.ClsLesson.Teacher != null &&
                            sTimeTchs.Contains(act.ClsLesson.Teacher))
                        {
                            FutureRules[time] = eRule.crisscross;  //此课程移到sTime后导致教师冲突
                        }
                        else
                        {
                            FutureRules[time] = ClsLsnRuleList[act.ClsLesson][sTime]; //移到sTime后的优势
                        }
                    }
                }
            }
            else
            {
                //所有Act移动到未排,则优势一定是eRule.common
                foreach (VcTime time in FutureRules.eachTime())
                {
                    FutureRules[time] = eRule.common;
                }
            }

            //四、获得sAct移动到所有位置的优势值
            DtMatrix <eRule> sActFutureRules = new DtMatrix <eRule>(DataRule.Solution);

            DtMatrix <eRule> TmpRules = ClsLsnRuleList[sAct.ClsLesson];

            foreach (VcTime time in TmpRules.eachTime())
            {
                sActFutureRules[time] = TmpRules[time];
            }

            //检测课程冲突
            if (sAct.ClsLesson.Teacher != null)
            {
                EnTeacher NowTch = sAct.ClsLesson.Teacher;
                DtMatrix <IList <EnLsnAct> > sTchLsns = this.GetTchMatrix(NowTch);
                foreach (VcTime time in sTchLsns.eachTime())
                {
                    if (sTchLsns[time] != null && sTchLsns[time].Count > 0)
                    {
                        foreach (EnLsnAct act in sTchLsns[time])
                        {
                            if (act != NowSch.Matrix[time].LsnAct && //当前课表的,会被移走
                                act.ClsLesson.Teacher == NowTch)
                            {
                                sActFutureRules[time] = eRule.crisscross;  //sAct移到time后将导致冲突
                                break;
                            }
                        }
                    }
                }
            }

            //五、比较当前优势和移动后的优势,获得交换的价值矩阵
            DtMatrix <eRule> Result = new DtMatrix <eRule>(DataRule.Solution);

            //NowRules、sActNowRule、FutureRules、sActFutureRules
            //所有位置当前优势\拖动源当前优势\所有位置在拖动源的优势\拖动源拖到所有位置的优势

            foreach (VcTime time in Result.eachTime())
            {
                if (NowSch.Matrix[time].LsnAct != null &&
                    NowSch.Matrix[time].LsnAct.ClsLesson == sAct.ClsLesson)
                {
                    Result[time] = eRule.crisscross; //同样的课移动没意义的
                    continue;
                }

                Result[time] = ComparerActChangeRule(NowRules[time], sActNowRule,
                                                     FutureRules[time], sActFutureRules[time]);
            }

            return(Result);
        }
Beispiel #24
0
        /// <summary>
        /// 仅负责把空课安排到合适的位置,不会动已排的课
        /// </summary>
        private Boolean Automatic(EnSquad squad)
        {
            if (SqdScheduleList[squad].FailLsnActs.Count == 0)
            {
                return(false);
            }

            //策略:
            //第一步:整理FailLsnActs到有序(同VcClsLesson相邻,为提高速度)
            //对每一VcLsnAct:计算优势值(靠评价函数),安排到优势值最大的Time

            SqdSchedule sch = SqdScheduleList[squad];

            sch.Modified = true;
            IList <EnLsnAct> OrderFailLsnActs = GetOrderFailLsnActs(sch.FailLsnActs);
            Int32            DaySum           = 0;

            foreach (Boolean bl in DataRule.Solution.ActiveWeekArr)
            {
                if (bl)
                {
                    DaySum++;
                }
            }

            EnClsLesson        frontClsLsn  = null;
            DtMatrix <Boolean> TchConcretes = null;
            DtMatrix <eRule>   ClsLsnRules  = null;

            Int32[] CourseCnt     = new Int32[7];
            Int32   CourseAverage = 0;

            foreach (EnLsnAct act in OrderFailLsnActs)
            {
                if (frontClsLsn == null || frontClsLsn != act.ClsLesson)
                {
                    frontClsLsn  = act.ClsLesson;
                    TchConcretes = new DtMatrix <bool>(DataRule.Solution);
                    ClsLsnRules  = this.ClsLsnRuleList[act.ClsLesson];

                    if (act.ClsLesson.Teacher != null)
                    {
                        foreach (VcTime time in sch.Matrix.eachTime())
                        {
                            if (sch.Matrix[time].LsnAct == null)
                            {
                                foreach (SqdSchedule sqdSch in SqdScheduleList.Values)
                                {
                                    if (sqdSch.Matrix[time].LsnAct != null &&
                                        sqdSch.Matrix[time].LsnAct.ClsLesson.Teacher == act.ClsLesson.Teacher)
                                    {
                                        TchConcretes[time] = true;
                                        break;
                                    }
                                }
                            }
                        }
                    }

                    //foreach (Int32 cnt in CourseCnt)
                    //    cnt = 0;
                    for (Int32 i = 0; i <= 6; i++)
                    {
                        CourseCnt[i] = 0;
                    }
                    Int32 CourseSum = 0;
                    foreach (VcTime time in sch.Matrix.eachTime())
                    {
                        if (sch.Matrix[time].LsnAct != null &&
                            sch.Matrix[time].LsnAct.ClsLesson.Lesson.Course == act.ClsLesson.Lesson.Course)
                        {
                            CourseCnt[(Int32)time.Week]++;
                            CourseSum++;
                        }
                    }
                    foreach (EnLsnAct failAct in sch.FailLsnActs)
                    {
                        if (failAct.ClsLesson.Lesson.Course == act.ClsLesson.Lesson.Course)
                        {
                            CourseSum++;
                        }
                    }
                    if (DaySum == 0)
                    {
                        CourseAverage = 0;
                    }
                    else
                    {
                        CourseAverage = (CourseSum + DaySum - 1) / DaySum;
                    }
                }

                //TchConcretes true教师冲突
                //ClsLsnRules 规则
                //CourseCnt 此课每天已经上的节数(数组)
                //CourseSum 此课每周总课时
                //CourseAverage 每天平均上课节数

                DtMatrix <Int32> Advantages = new DtMatrix <Int32>(DataRule.Solution);
                foreach (VcTime time in sch.Matrix.eachTime())
                {
                    if (sch.Matrix[time].LsnAct != null)
                    {
                        Advantages[time] = Int32.MinValue;
                    }
                    else
                    {
                        Advantages[time] = TchConcretes[time] ? -2 : (Int32)ClsLsnRules[time];
                        if (CourseCnt[(Int32)time.Week] >= CourseAverage)
                        {
                            if (Advantages[time] > -1)
                            {
                                Advantages[time] = -1;   //这一天上课比较多
                            }
                        }
                    }
                }

                Int32 MaxAdvantage      = Int32.MinValue;
                VcTime MaxAdvantageTime = new VcTime();
                foreach (VcTime time in Advantages.eachTime())
                {
                    if (MaxAdvantage < Advantages[time])
                    {
                        MaxAdvantage = Advantages[time];
                        time.CopyFieldTo(MaxAdvantageTime);
                    }
                }

                if (MaxAdvantage == Int32.MinValue)
                {
                    return(true); //没地方排了
                }
                if (MaxAdvantage >= -1)
                {
                    CourseCnt[(Int32)MaxAdvantageTime.Week]++;
                    sch.Matrix[MaxAdvantageTime].LsnAct = act;
                    sch.FailLsnActs.Remove(act);
                }
            }

            foreach (VcTime time in sch.Matrix.eachTime())
            {
                if (sch.FailLsnActs.Count > 0 && sch.Matrix[time].LsnAct == null)
                {
                    sch.Matrix[time].LsnAct = sch.FailLsnActs[sch.FailLsnActs.Count - 1];
                    sch.FailLsnActs.RemoveAt(sch.FailLsnActs.Count - 1);
                }
            }

            return(true);
        }
        private void btnPayments_ClickBefore(object sboObject, SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;
            Form lObjPaymentForm    = null;
            Form lObjPaymentFormUDF = null;
            Form lObjAccountForm    = null;

            try
            {
                if (mIntRowSelected > 0)
                {
                    StatusEnum lEnmStatus      = (StatusEnum)int.Parse(DtMatrix.GetValue("C_Status", mIntRowSelected - 1).ToString());
                    string     lStrFolio       = DtMatrix.GetValue("C_Folio", mIntRowSelected - 1).ToString();
                    string     lStrEmpCode     = DtMatrix.GetValue("C_Employe", mIntRowSelected - 1).ToString();
                    string     lStrArea        = DtMatrix.GetValue("C_Area", mIntRowSelected - 1).ToString();
                    double     lDblImport      = double.Parse(DtMatrix.GetValue("C_Amount", mIntRowSelected - 1).ToString());
                    string     lStrEmpName     = mObjPurchasesServiceFactory.GetPurchaseService().GetEmpName(lStrEmpCode);
                    string     lStrLineAccount = mObjPurchasesServiceFactory.GetPurchaseReceiptsService().GetAccountRefund(lStrArea);
                    //string lStrChkAcct = mObjPurchasesServiceFactory.GetPurchaseReceiptsService().GetAccountInConfig("GLO_CTAREEMBCHEQ");
                    string lStrChkAcct = cbAccount.Value;
                    // Dictionary<string, string> lStrBankInfo = mObjPurchasesServiceFactory.GetPurchaseReceiptsService().GetBankInfo(lStrChkAcct);
                    Dictionary <string, string> lStrBankInfo = new Dictionary <string, string>();
                    lStrBankInfo.Add(cbAccount.Value, cbBank.Selected.Description);

                    if (lEnmStatus != StatusEnum.Authorized_Ope_Admon)
                    {
                        UIApplication.ShowError("El reembolso seleccionado no está autorizado");
                        return;
                    }

                    string lStrValidation = ValidatePaymentsFields(lStrFolio, lStrEmpCode, lStrArea, lDblImport, lStrChkAcct, lStrBankInfo, lStrLineAccount);
                    if (!string.IsNullOrEmpty(lStrValidation))
                    {
                        UIApplication.ShowMessageBox(lStrValidation);
                        return;
                    }
                    if (mObjPurchasesServiceFactory.GetPurchaseReceiptsService().ExistsPayment(lStrEmpCode, lStrFolio, lStrArea))

                    /*string lStrDocEntry = DtMatrix.GetValue("C_DocEntry", mIntRowSelected - 1).ToString();
                     * if (mObjPurchasesServiceFactory.GetPurchaseReceiptsService().ExistsPayment(lStrDocEntry))*/
                    {
                        UIApplication.ShowError("Ya existe un pago para el reembolso seleccionado");
                        return;
                    }
                    this.UIAPIRawForm.Freeze(true);
                    UIApplication.GetApplication().ActivateMenuItem("2818");
                    if (!UIApplication.GetApplication().Menus.Item("6913").Checked)
                    {
                        UIApplication.GetApplication().ActivateMenuItem("6913");//2050
                    }

                    lObjPaymentForm    = UIApplication.GetApplication().Forms.GetForm("426", -1);
                    lObjPaymentFormUDF = UIApplication.GetApplication().Forms.GetForm("-426", -1);

                    lObjPaymentForm.Freeze(true);
                    lObjPaymentFormUDF.Freeze(true);
                    SAPbouiCOM.EditText txtDocDate = ((SAPbouiCOM.EditText)lObjPaymentForm.Items.Item("10").Specific);
                    txtDocDate.Value = DateTime.Now.ToString("yyyyMMdd");

                    SAPbouiCOM.OptionBtn optionBtnAccount = ((SAPbouiCOM.OptionBtn)lObjPaymentForm.Items.Item("58").Specific);
                    optionBtnAccount.Selected = true;

                    SAPbouiCOM.ComboBox cboPymtType = ((SAPbouiCOM.ComboBox)lObjPaymentFormUDF.Items.Item("U_GLO_PaymentType").Specific);
                    cboPymtType.Select("GLREM", SAPbouiCOM.BoSearchKey.psk_ByValue);

                    SAPbouiCOM.EditText txtCodeMov = ((SAPbouiCOM.EditText)lObjPaymentFormUDF.Items.Item("U_GLO_CodeMov").Specific);
                    txtCodeMov.Value = lStrFolio;

                    SAPbouiCOM.ComboBox txtCostCenter = ((SAPbouiCOM.ComboBox)lObjPaymentFormUDF.Items.Item("U_GLO_CostCenter").Specific);
                    txtCostCenter.Select(lStrArea, SAPbouiCOM.BoSearchKey.psk_ByValue);

                    SAPbouiCOM.ComboBox cboAuxiliarType = ((SAPbouiCOM.ComboBox)lObjPaymentFormUDF.Items.Item("U_FZ_AuxiliarType").Specific);
                    cboAuxiliarType.Select("2", SAPbouiCOM.BoSearchKey.psk_ByValue);

                    SAPbouiCOM.EditText txtName = ((SAPbouiCOM.EditText)lObjPaymentForm.Items.Item("10000166").Specific);
                    txtName.Value = lStrEmpName;

                    SAPbouiCOM.EditText txtAuxiliar = ((SAPbouiCOM.EditText)lObjPaymentFormUDF.Items.Item("U_FZ_Auxiliar").Specific);
                    txtAuxiliar.Value = lStrEmpCode;


                    SAPbouiCOM.Button btnBank = ((SAPbouiCOM.Button)lObjPaymentForm.Items.Item("234000001").Specific);
                    btnBank.Item.Click();

                    lObjAccountForm = UIApplication.GetApplication().Forms.GetForm("196", -1);
                    lObjAccountForm.Freeze(true);
                    SAPbouiCOM.Folder folderCheck = ((SAPbouiCOM.Folder)lObjAccountForm.Items.Item("3").Specific);
                    folderCheck.Item.Click();

                    SAPbouiCOM.Matrix mtxCheck = ((SAPbouiCOM.Matrix)lObjAccountForm.Items.Item("28").Specific);
                    ((SAPbouiCOM.EditText)mtxCheck.Columns.Item("7").Cells.Item(1).Specific).Value = lDblImport.ToString();

                    ComboBox cb = ((SAPbouiCOM.ComboBox)mtxCheck.Columns.Item("2").Cells.Item(1).Specific);

                    string ss = lStrBankInfo[lStrBankInfo.Keys.ElementAt(0)]; //lStrBankInfo.ElementAt(0);


                    ((SAPbouiCOM.ComboBox)mtxCheck.Columns.Item("2").Cells.Item(1).Specific).Select(lStrBankInfo[lStrBankInfo.Keys.ElementAt(0)], SAPbouiCOM.BoSearchKey.psk_ByValue); //Banco
                    ((SAPbouiCOM.ComboBox)mtxCheck.Columns.Item("4").Cells.Item(1).Specific).Select(lStrBankInfo.Keys.ElementAt(0), SAPbouiCOM.BoSearchKey.psk_ByValue);               //Cuenta?

                    SAPbouiCOM.Button btnOk = ((SAPbouiCOM.Button)lObjAccountForm.Items.Item("1").Specific);
                    btnOk.Item.Click();

                    SAPbouiCOM.Matrix mtxPayment = ((SAPbouiCOM.Matrix)lObjPaymentForm.Items.Item("71").Specific);
                    mtxPayment.AddRow();
                    ((SAPbouiCOM.EditText)mtxPayment.Columns.Item("5").Cells.Item(1).Specific).Value = lDblImport.ToString();
                    ((SAPbouiCOM.EditText)mtxPayment.Columns.Item("8").Cells.Item(1).Specific).Value = lStrLineAccount; //cuenta de mayor
                }
                else
                {
                    UIApplication.ShowMessageBox("Favor de seleccionar un registro");
                }



                lObjPaymentFormUDF.Freeze(false);
                this.UIAPIRawForm.Freeze(false);



                if (lObjPaymentForm != null)
                {
                    lObjPaymentForm.Freeze(false);
                }
                if (lObjAccountForm != null)
                {
                    lObjPaymentFormUDF.Freeze(false);
                }
                if (this.UIAPIRawForm != null)
                {
                    this.UIAPIRawForm.Freeze(false);
                }
                // if (lObjAccountForm. ==) lObjAccountForm.Freeze(false);
                UIApplication.ShowSuccess("Carga de pago terminada");
            }
            catch (Exception ex)
            {
                LogService.WriteError("frmSearchRefunds (btnPayments_ClickBefore) " + ex.Message);
                LogService.WriteError(ex);
                UIApplication.ShowMessageBox(string.Format("Error al abrir pantalla de pagos: {0}", ex.Message));
            }
            finally
            {
                if (lObjPaymentFormUDF != null)
                {
                    lObjPaymentFormUDF.Freeze(false);
                }
                this.UIAPIRawForm.Freeze(false);
            }
        }