Example #1
0
        public Transition_SponsorWindow(Sponsor s, FundType ft)
        {
            InitializeComponent();
            txtSponsorName.Text = s.Name;
            var i = new Invoice();

            i.AddTransition();
            i.Transitions[0].LeftAccount = s.Account;

            if (ft == FundType.GeneralHidden)
            {
                i.Transitions[0].IsHidden = true;
                txtHeader.Text           += " (ايداع مخفي)";
            }

            if (ft == FundType.Private)
            {
                cmboAccounts.ItemsSource = BaseDataBase._Tabling("select Id, Name from Account where Id between 2 and 4").DefaultView;
            }
            else
            {
                cmboAccounts.ItemsSource   = BaseDataBase._Tabling("select Id, Name from Account where Id = 1").DefaultView;
                cmboAccounts.SelectedIndex = 0;
                GetCurrentBalance(s.Account.Id.Value, 1);
            }

            this.DataContext = i;
        }
Example #2
0
        public Transition_OrphanFamilyWindow(Family f)
        {
            InitializeComponent();
            this.f         = f;
            txtFamily.Text = f.FamilyCode;
            var i = new Invoice();

            foreach (var o in f.FamilyOrphans.Where(x => x.Type != "طالب علم" && x.CurrentSponsorship != null))
            {
                var t = i.AddTransition();
                t.RightAccount = o.Account;
                t.Value        = o.CurrentSponsorship.AvailableSponsorship.SponsorshipValue;
                t.Value        = o.CurrentSponsorship.IsDouble ? t.Value * 2 : t.Value;
                t.Details      = "دفعة من صندوق الايتام";
                t.LeftAccount  = new Account()
                {
                    Id = (o.Type == "يتيم" ? 2 : 3)
                };                                                                //the id of ophan fund (2) account or ophan student fund (3) account
                t.RelatedSponsorship            = o.CurrentSponsorship;
                t.RelatedSponsorship.OrphanName = o.FirstName + " " + o.LastName;
                t.SponsorshipID = o.CurrentSponsorship.ID;
                t.AccountType   = (o.Type == "يتيم" ? Account.AccountType.Orphan : Account.AccountType.OrphanStudent); //the ophan type (2) or ophan student type (3)
            }

            i.Serial         = "A";
            i.Receiver       = BaseDataBase._Scalar($"select FirstName + ' ' + Isnull(LastName,'') from Parent where FamilyID = {f.FamilyID} and Gender = 'أنثى'");
            i.ReceiverPID    = BaseDataBase._Scalar($"select IsNull(PID,'') from Parent where FamilyID = {f.FamilyID} and Gender = 'أنثى'");
            this.DataContext = i;
        }
        public Transition_Expenses(FundType ft)
        {
            InitializeComponent();
            var i = new Invoice();
            var t = i.AddTransition();

            t.LeftAccount = new Account {
                Id = 1
            };                                          //1 is general fund account id
            t.RightAccount = new Account {
                Id = 5
            };                                          //5 is expenses account id

            if (ft == FundType.GeneralHidden)
            {
                t.IsHidden         = true;
                txtMsg1.Visibility = Visibility.Visible;
                txtMsg2.Visibility = Visibility.Collapsed;
                var r = BaseDataBase._Scalar($@"select dbo.fn_GetHiddenBalance()");
                txtBalance.Text = r;
            }
            else
            {
                var r = BaseDataBase._Scalar($@"(select
			        (select isnull(sum(Value),0) from Transition where IsHidden = 0 and RightAccount = 1 - 
			        (select isnull(sum(Value),0) from Transition where IsHidden = 0 and LeftAccount = 1))"            );
                txtBalance.Text = r;
            }
            this.DataContext = i;
        }
Example #4
0
        public Transition_StudentWindow(Orphan o)
        {
            InitializeComponent();
            this.o          = o;
            txtStudent.Text = o.FirstName + " " + o.LastName;
            var i = new Invoice();
            var t = i.AddTransition();

            t.RightAccount = o.Account;
            t.LeftAccount  = new Account()
            {
                Id = 4
            };                                        //4 is the id of student fund account
            t.Value         = o.CurrentSponsorship.AvailableSponsorship.SponsorshipValue;
            t.Value         = o.CurrentSponsorship.IsDouble ? t.Value * 2 : t.Value;
            t.SponsorshipID = o.CurrentSponsorship.ID;
            t.AccountType   = Account.AccountType.Student; // 4 is the student type id
            txtSponsor.Text = o.CurrentSponsorship.AvailableSponsorship.RelatedSponsor.Name;

            i.Serial         = "B";
            i.Receiver       = BaseDataBase._Scalar($"select FirstName + ' ' + Isnull(LastName,'') from Parent where FamilyID = {o.OrphanFamily.FamilyID} and Gender = 'أنثى'");
            i.ReceiverPID    = BaseDataBase._Scalar($"select IsNull(PID,'') from Parent where FamilyID = {o.OrphanFamily.FamilyID} and Gender = 'أنثى'");
            this.DataContext = i;
        }