Beispiel #1
0
        public void setForToday()
        {
            clsServiceItems.openAll();

            //Opens the last 15 and next 5 service dates from today
            clsDaysOpen.openTopTwentyWithinDate(DateTime.Today);

            FoodItems    = new List <ServiceItem>();
            NonFoodItems = new List <ServiceItem>();

            findSvcDate();   //Figure out what the best service date to use is
            fillItemsList(); //Fill the service items collections

            firstFoodItemDescSet = false;
        }
        public void initForm(Client clsClientIn, bool ModeIn, bool isApptIn, int TrxIndexIn, int hhMemID)
        {
            clsClient = clsClientIn;
            clsTrxLog = clsClient.clsHHSvcTrans;
            isNewTrx  = ModeIn;
            isAppt    = isApptIn;

            if (isNewTrx == false)
            {
                chkManualEntry.Checked          = true;
                chkEnterNonFoodManually.Checked = true;
            }
            else
            {
                chkManualEntry.Checked          = false;
                chkEnterNonFoodManually.Checked = false;
            }

            SetDisplayMode();
            //cboClientType.
            for (int i = 0; i < cboClientType.Items.Count; i++)
            {
                if (clsClient.clsHH.ClientType == Convert.ToInt16(clsParmClientType.DSet.Tables[0].Rows[i]["ID"]))
                {
                    cboClientType.SelectedIndex = i;
                    break;
                }
            }

            if (TrxIndexIn < 0)
            {
                clsTrxItem = new TrxLogItem(clsTrxLog.DSet.Tables[0].NewRow(), clsClient.clsHH, hhMemID);
                if (isAppt == true)
                {
                    BackColor            = CCFBGlobal.bkColorApptEdit;
                    trxDateIn            = CCFBGlobal.DefalutApptDate;
                    lblService.Text      = "New Appointment";
                    clsTrxItem.TrxStatus = CCFBGlobal.statusTrxLog_NewAppt;
                }
                else
                {
                    BackColor            = CCFBGlobal.bkColorBaseEdit;
                    trxDateIn            = CCFBGlobal.DefaultServiceDate;
                    lblService.Text      = "New Service Transaction";
                    clsTrxItem.TrxStatus = CCFBGlobal.statusTrxLog_Service;
                }
                clsTrxItem.TrxDate = Convert.ToDateTime(trxDateIn);
                clsDaysOpen.openTopTwentyWithinDate(clsTrxItem.TrxDate);
                clsDaysOpen.FindDate(clsTrxItem.TrxDate);
                CCFBGlobal.clsDailyItems.SetServiceDate(trxDateIn, clsDaysOpen.IsCommodity, clsDaysOpen.SpecialItems);
                CCFBGlobal.clsDailyItems.InitClientData(clsClient);
                MarkNewServiceItems();
            }
            else
            {
                if (clsTrxLog.TrxId != TrxIndexIn)
                {
                    clsTrxLog.find(TrxIndexIn);
                }
                clsTrxItem = new TrxLogItem(clsTrxLog.DRow);
                trxDateIn  = clsTrxItem.TrxDate.ToShortDateString();
                if (clsTrxItem.TrxStatus == CCFBGlobal.statusTrxLog_Service || isAppt == false)
                {
                    lblService.Text = "Edit Service Transaction";
                    BackColor       = CCFBGlobal.bkColorBaseEdit;
                    if (isAppt == true)
                    {
                        lblService.Text      = "Convert Appointment to Service Transaction";
                        clsTrxItem.TrxStatus = CCFBGlobal.statusTrxLog_Service;
                        MarkNewServiceItems();
                    }
                    else
                    {
                        lblService.Text = "Edit Service Transaction";
                    }
                }
                else
                {
                    lblService.Text = "Edit Appointment";
                    BackColor       = CCFBGlobal.bkColorApptEdit;
                }
                clsDaysOpen.FindDate(clsTrxItem.TrxDate);
                CCFBGlobal.clsDailyItems.SetServiceDate(trxDateIn, clsDaysOpen.IsCommodity, clsDaysOpen.SpecialItems);
                CCFBGlobal.clsDailyItems.InitClientData(clsClient);
                CheckServiceItemsFromList(clsTrxItem.ConcatFoodSvcItemsList, CCFBGlobal.clsDailyItems.FoodItemsList);
                CheckServiceItemsFromList(clsTrxItem.ConcatNonFoodSvcItemsList, CCFBGlobal.clsDailyItems.NonFoodItemsList);
            }
            loadingControls = true;
            CCFBGlobal.clsDailyItems.fillListViewItems(lvwFoodSvcItems, lvwNonFoodSvcItems, lvwBabyServices);
            if (lvwNonFoodSvcItems.Items.Count == 0)
            {
                lvwNonFoodSvcItems.Visible      = false;
                chkEnterNonFoodManually.Checked = true;
            }

            fillForm();
        }