Ejemplo n.º 1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            if (!((GlobalvarsApp)this.Application).ISLOGON)
            {
                Finish();
            }
            SetTitle(Resource.String.title_payment);
            SetContentView(Resource.Layout.Payment);
            string samt = Intent.GetStringExtra("amount") ?? "0";

            amount = Convert.ToDouble(samt);

            txtAmt      = FindViewById <EditText> (Resource.Id.payamt);
            txtRound    = FindViewById <EditText> (Resource.Id.payround);
            txtTotal    = FindViewById <EditText> (Resource.Id.paytotal);
            txtCash     = FindViewById <EditText> (Resource.Id.paycash);
            txtChange   = FindViewById <EditText> (Resource.Id.paychange);
            txtAmt.Text = amount.ToString("n2");
            double roundVal = 0;
            double ttlAmt   = Utility.AdjustToNear(amount, ref roundVal);

            txtRound.Text             = roundVal.ToString("n2");
            txtTotal.Text             = ttlAmt.ToString("n2");
            txtCash.EditorAction     += HandleEditorAction;
            txtCash.AfterTextChanged += TxtCash_AfterTextChanged;
            Button butInvBack = FindViewById <Button> (Resource.Id.payok);

            butInvBack.Click += (object sender, EventArgs e) => {
                base.OnBackPressed();
            };
            txtCash.RequestFocus();
        }
Ejemplo n.º 2
0
        public override Dialog OnCreateDialog(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Begin building a new dialog.
            this.SetStyle(DialogFragmentStyle.Normal, Android.Resource.Style.ThemeDialog);
            var builder = new AlertDialog.Builder(this.Activity);
            //Get the layout inflater
            var inflater = Activity.LayoutInflater;

            var view = inflater.Inflate(Resource.Layout.Payment, null);

            txtAmt = view.FindViewById <EditText> (Resource.Id.payamt);
            if (txtAmt != null)
            {
                txtRound  = view.FindViewById <EditText> (Resource.Id.payround);
                txtTotal  = view.FindViewById <EditText> (Resource.Id.paytotal);
                txtCash   = view.FindViewById <EditText> (Resource.Id.paycash);
                txtChange = view.FindViewById <EditText> (Resource.Id.paychange);
                Button butInvBack = view.FindViewById <Button> (Resource.Id.payok);
                txtCust   = view.FindViewById <EditText> (Resource.Id.newinv_custname);
                txtRemark = view.FindViewById <EditText> (Resource.Id.newinv_remark);
                txtInvno  = view.FindViewById <EditText> (Resource.Id.newinvno);

                txtRemark.Text = Remark;
                txtInvno.Text  = InvNo;
                txtCust.Text   = CustName;
                txtAmt.Text    = _amount.ToString("n2");
                double roundVal = 0;
                double ttlAmt   = Utility.AdjustToNear(_amount, ref roundVal);
                txtRound.Text             = roundVal.ToString("n2");
                txtTotal.Text             = ttlAmt.ToString("n2");
                txtCash.EditorAction     += HandleEditorAction;
                txtCash.AfterTextChanged += TxtCash_AfterTextChanged;
                txtCash.Text              = "";
                butInvBack.Visibility     = ViewStates.Gone;

                builder.SetView(view);
                builder.SetPositiveButton(Resources.GetString(Resource.String.button_paidprint), HandlePositiveButtonClick);
                builder.SetNegativeButton(Resources.GetString(Resource.String.button_cancel), HandleNegativeButtonClick);
                builder.SetNeutralButton(Resources.GetString(Resource.String.button_paid), HandlePaidOnlyButtonClick);
                builder.SetCancelable(false);

                txtCash.RequestFocus();
                ShowKeyBoard(view);
            }
            var dialog = builder.Create();
            //Now return the constructed dialog to the calling activity


            WindowManagerLayoutParams wmlp = dialog.Window.Attributes;

            wmlp.Gravity = GravityFlags.Top | GravityFlags.Center;
            return(dialog);
        }
Ejemplo n.º 3
0
        void populate(List <InvoiceDtls> list)
        {
            list.Clear();
            using (var db = new SQLite.SQLiteConnection(pathToDatabase)) {
                var list2 = db.Table <InvoiceDtls> ()
                            .Where(x => x.invno == inv.invno)
                            .OrderByDescending(x => x.ID)
                            .ToList <InvoiceDtls> ();

                ttlamt = 0;
                ttltax = 0;
                foreach (var item in list2)
                {
                    ttlamt = ttlamt + item.netamount;
                    ttltax = ttltax + item.tax;
                    list.Add(item);
                }

                double roundVal = 0;
                double ttlNet   = Utility.AdjustToNear(ttlamt + ttltax, ref roundVal);


                InvoiceDtls inv1 = new InvoiceDtls();
                inv1.icode       = "TAX";
                inv1.netamount   = ttlamt;
                inv1.description = "TOTAL EXCL GST";
                InvoiceDtls inv2 = new InvoiceDtls();
                inv2.icode       = "AMOUNT";
                inv2.netamount   = ttltax;
                inv2.description = "TOTAL 6% GST";
                InvoiceDtls inv3 = new InvoiceDtls();
                inv3.icode       = "TAX";
                inv3.netamount   = ttlamt + ttltax;
                inv3.description = "TOTAL INCL GST";
                InvoiceDtls inv4 = new InvoiceDtls();
                inv4.icode       = "AMOUNT";
                inv4.netamount   = roundVal;
                inv4.description = "ROUNDING ADJUST";
                InvoiceDtls inv5 = new InvoiceDtls();
                inv5.icode       = "AMOUNT";
                inv5.netamount   = ttlNet;
                inv5.description = "NET TOTAL";


                list.Add(inv1);
                list.Add(inv2);
                list.Add(inv3);
                if (TRXTYPE == "CASH")
                {
                    list.Add(inv4);
                    list.Add(inv5);
                }
            }
        }
Ejemplo n.º 4
0
        public void PrintTotalAjust(ref string test, double ttlAmt, double ttlTax)
        {
            double roundVal   = 0;
            double ttlRounAmt = Utility.AdjustToNear(ttlAmt + ttlTax, ref roundVal);

            test += "------------------------------------------\n";
            test += "               TOTAL EXCL GST " + Math.Round(ttlAmt, 2).ToString("n2").PadLeft(12, ' ') + "\n";
            test += "               TOTAL TAX      " + Math.Round(ttlTax, 2).ToString("n2").PadLeft(12, ' ') + "\n";
            test += "               TOTAL INCL GST " + Math.Round(ttlAmt + ttlTax, 2).ToString("n2").PadLeft(12, ' ') + "\n";
            test += "               ROUNDING ADJ   " + Math.Round(roundVal, 2).ToString("n2").PadLeft(12, ' ') + "\n";
            test += "               TOTAL AMOUNT   " + Math.Round(ttlRounAmt, 2).ToString("n2").PadLeft(12, ' ') + "\n";
            test += "------------------------------------------\n";
        }
Ejemplo n.º 5
0
        public void PrintTotalAjust(ref string test, double cnttlAmt, double cnttlTax, double InvttlAmt, double invttlTax)
        {
            double roundVal = 0;
            //double ttlCollect = (InvttlAmt + invttlTax) - (cnttlAmt + cnttlTax);
            double ttlInv     = Utility.AdjustToNear(InvttlAmt + invttlTax, ref roundVal);
            double ttlCN      = Utility.AdjustToNear(cnttlAmt + cnttlTax, ref roundVal);
            double ttlCollect = ttlInv - ttlCN;

            test += "------------------------------------------\n";
            test += "  TOTAL INVOICE AMOUNT : " + Math.Round(ttlInv, 2).ToString("n2").PadLeft(12, ' ') + "\n";
            test += "  TOTAL C/NOTE AMOUNT  : " + Math.Round(ttlCN, 2).ToString("n2").PadLeft(12, ' ') + "\n";
            test += "  TOTAL COLLECT AMOUNT : " + Math.Round(ttlCollect, 2).ToString("n2").PadLeft(12, ' ') + "\n";
            test += "------------------------------------------\n";
        }
Ejemplo n.º 6
0
        private string GetInvoiceSumm(DateTime printDate1, DateTime printDate2)
        {
            string text       = "";
            int    count      = 0;
            double ttlAmtl    = 0;
            double ttlCN      = 0;
            double ttl        = 0;
            double rate       = 0;
            double roundVal   = 0;
            double GranInv    = 0;
            double GranCN     = 0;
            double GranCSInv  = 0;
            double GranCSCN   = 0;
            string cnno       = "";
            bool   isSamedate = printDate1 == printDate2;

            string           pathToDatabase = ((GlobalvarsApp)Application.Context).DATABASE_PATH;
            SQLiteConnection db             = new SQLiteConnection(pathToDatabase);

            PrintSummHeader(printDate1, printDate2, ref text);
            var list   = db.Table <Invoice>().ToList();
            var cnlist = db.Table <CNNote>().ToList();
            var grps   = from p in list
                         where p.invdate >= printDate1 && p.invdate <= printDate2
                         group p by p.invdate into g
                         select new { key = g.Key, result = g.ToList() };


            foreach (var grp in grps)
            {
                count     = 1;
                GranInv   = 0;
                GranCN    = 0;
                GranCSInv = 0;
                GranCSCN  = 0;
                //"------------------------------------------\";
                //12. 123456789012345678901234567890 12345567

                //CN without Inv
                var cnNoInvs = cnlist.Where(x => x.invdate == grp.key && x.invno == "");
                if (!isSamedate)
                {
                    text = text + grp.key.ToString("dd-MM-yyyy") + "\n";
                    text = text + "------------------------------------------\n";
                }
                foreach (var itm in grp.result)
                {
                    ttlAmtl = itm.amount + itm.taxamt;
                    ttlCN   = 0;
                    ttl     = 0;
                    cnno    = "";
                    //var cninv = cnlist.Where(x => x.invno == itm.invno && x.invdate == itm.invdate).FirstOrDefault();
                    var cninv = cnlist.Where(x => x.invno == itm.invno).FirstOrDefault();
                    if (cninv != null)
                    {
                        cnno  = cninv.cnno;
                        ttlCN = cninv.amount + cninv.taxamt;
                    }

                    if (itm.trxtype == "CASH")
                    {
                        ttlAmtl   = Utility.AdjustToNear(ttlAmtl, ref roundVal);
                        ttlCN     = Utility.AdjustToNear(ttlCN, ref roundVal);
                        GranCSInv = GranCSInv + ttlAmtl;
                        GranCSCN  = GranCSCN + ttlCN;
                    }
                    else
                    {
                        GranInv = GranInv + ttlAmtl;
                        GranCN  = GranCN + ttlCN;
                    }
                    if (itm.description.Length > 30)
                    {
                        //12. 123456789012345678901234567890 12345567
                        text = text + count.ToString().PadRight(2, ' ') + ". " + itm.description.Substring(0, 30) + " " + itm.created.ToString("hh:mmtt") + "\n";
                        text = text + "".PadRight(4, ' ') + itm.description.Substring(30).Trim() + "\n";
                    }
                    else
                    {
                        text = text + count.ToString().PadRight(2, ' ') + ". " + itm.description.PadRight(30, ' ') + " " + itm.created.ToString("hh:mmtt") + "\n";
                    }

                    text = text + "INV AMT -" + itm.invno.PadRight(21, ' ') + ttlAmtl.ToString("n2").PadLeft(12, ' ') + "\n";
                    text = text + "CN AMT  -" + cnno.PadRight(21, ' ') + ttlCN.ToString("n2").PadLeft(12, ' ') + "\n";

                    ttl = ttlAmtl - ttlCN;
                    if (ttlCN > 0)
                    {
                        rate = Math.Round((ttlCN / ttlAmtl) * 100, 2);
                    }

                    text = text + "TOTAL COLLECT AMOUNT  -".PadRight(30, ' ') + ttl.ToString("n2").PadLeft(12, ' ') + "\n";
                    text = text + "RETURN RATE %         -".PadRight(30, ' ') + rate.ToString("n2").PadLeft(12, ' ') + "\n\n";

                    count += 1;
                }


                foreach (var itm in cnNoInvs)
                {
                    ttlAmtl = 0;
                    ttlCN   = itm.amount + itm.taxamt;
                    ttl     = 0;
                    cnno    = "";

                    if (itm.trxtype == "CASH")
                    {
                        ttlCN    = Utility.AdjustToNear(ttlCN, ref roundVal);
                        GranCSCN = GranCSCN + ttlCN;
                    }
                    else
                    {
                        GranCN = GranCN + ttlCN;
                    }
                    if (itm.description.Length > 30)
                    {
                        //12. 123456789012345678901234567890 12345567
                        text = text + count.ToString().PadRight(2, ' ') + ". " + itm.description.Substring(0, 30) + " " + itm.created.ToString("hh:mmtt") + "\n";
                        text = text + "".PadRight(4, ' ') + itm.description.Substring(30).Trim() + "\n";
                    }
                    else
                    {
                        text = text + count.ToString().PadRight(2, ' ') + ". " + itm.description.PadRight(30, ' ') + " " + itm.created.ToString("hh:mmtt") + "\n";
                    }

                    text = text + "INV AMT -" + itm.invno.PadRight(21, ' ') + ttlAmtl.ToString("n2").PadLeft(12, ' ') + "\n";
                    text = text + "CN AMT  -" + itm.cnno.PadRight(21, ' ') + ttlCN.ToString("n2").PadLeft(12, ' ') + "\n";

                    ttl  = ttlAmtl - ttlCN;
                    rate = 0;

                    text = text + "TOTAL COLLECT AMOUNT  -".PadRight(30, ' ') + ttl.ToString("n2").PadLeft(12, ' ') + "\n";
                    text = text + "RETURN RATE %         -".PadRight(30, ' ') + rate.ToString("n2").PadLeft(12, ' ') + "\n\n";

                    count += 1;
                }

                text = text + "\n";
                text = text + "SALES SUMMARY\n\n";
                text = text + "TOTAL INVOICE ".PadRight(30, ' ') + GranInv.ToString("n2").PadLeft(12, ' ') + "\n";
                text = text + "TOTAL CN INVOICE".PadRight(30, ' ') + GranCN.ToString("n2").PadLeft(12, ' ') + "\n";
                text = text + "TOTAL INVOICE COLLECT ".PadRight(30, ' ') + (GranInv - GranCN).ToString("n2").PadLeft(12, ' ') + "\n\n";

                text = text + "TOTAL CASH ".PadRight(30, ' ') + GranCSInv.ToString("n2").PadLeft(12, ' ') + "\n";
                text = text + "TOTAL CN CASH".PadRight(30, ' ') + GranCSCN.ToString("n2").PadLeft(12, ' ') + "\n";
                text = text + "TOTAL CASH COLLECT ".PadRight(30, ' ') + (GranCSInv - GranCSCN).ToString("n2").PadLeft(12, ' ') + "\n\n";
            }

            text += "------------------------------------------\n";
            text += "CASH COLLECTION   :\n\n\n";
            text += "(-)DIESEL EXP     :\n\n\n";
            text += "(-)OTHER EXP      :\n\n\n";
            text += "(=)NET COLLECTION :\n\n\n";
            text += "(-)PAYMENT        :\n\n\n";
            text += "(=)SHORT          :\n\n\n";
            text += "PREPARED BY:\n\n\n\n\n";
            text += "VERIFY BY  :\n\n\n\n\n";
            text += "------------------------------------------\n\n\n\n";

            db.Close();

            return(text);
        }
Ejemplo n.º 7
0
        void populate(List <InvoiceDtls> list)
        {
            comp = DataHelper.GetCompany(pathToDatabase);
            //SqliteConnection.CreateFile(pathToDatabase);
            using (var db = new SQLite.SQLiteConnection(pathToDatabase))
            {
                var list1 = db.Table <Invoice>().Where(x => x.invno == invno).ToList <Invoice>();
                var list2 = db.Table <InvoiceDtls>().Where(x => x.invno == invno).ToList <InvoiceDtls>();
                var list3 = db.Table <Trader>().Where(x => x.CustCode == CUSTCODE).ToList <Trader>();

                double ttlamt = 0;
                double ttltax = 0;
                if (list3.Count > 0)
                {
                    CUSTNAME = list3 [0].CustName;
                }
                foreach (var item in list2)
                {
                    ttlamt = ttlamt + item.netamount;
                    ttltax = ttltax + item.tax;
                    list.Add(item);
                }
                if (list1.Count > 0)
                {
                    list1 [0].amount = ttlamt;
                    db.Update(list1 [0]);
                }
//				InvoiceDtls inv1 = new InvoiceDtls ();
//				inv1.icode = "TAX";
//				inv1.netamount = ttltax;
//				InvoiceDtls inv2 = new InvoiceDtls ();
//				inv2.icode = "AMOUNT";
//				inv2.netamount = ttlamt;
//
//				list.Add (inv1);
//				list.Add (inv2);

                double      roundVal = 0;
                double      ttlNet   = Utility.AdjustToNear(ttlamt + ttltax, ref roundVal);
                InvoiceDtls inv1     = new InvoiceDtls();
                inv1.icode       = "TAX";
                inv1.netamount   = ttlamt;
                inv1.description = "TOTAL EXCL GST";
                InvoiceDtls inv2 = new InvoiceDtls();
                inv2.icode       = "AMOUNT";
                inv2.netamount   = ttltax;
                inv2.description = "TOTAL 6% GST";
                InvoiceDtls inv3 = new InvoiceDtls();
                inv3.icode       = "TAX";
                inv3.netamount   = ttlamt + ttltax;
                inv3.description = "TOTAL INCL GST";
                InvoiceDtls inv4 = new InvoiceDtls();
                inv4.icode       = "AMOUNT";
                inv4.netamount   = roundVal;
                inv4.description = "ROUNDING ADJUST";
                InvoiceDtls inv5 = new InvoiceDtls();
                inv5.icode       = "AMOUNT";
                inv5.netamount   = ttlNet;
                inv5.description = "NET TOTAL";


                list.Add(inv1);
                list.Add(inv2);
                list.Add(inv3);
                if (TRXTYPE == "CASH")
                {
                    list.Add(inv4);
                    list.Add(inv5);
                }
            }
        }
Ejemplo n.º 8
0
        void populate(List <CNNoteDtls> list)
        {
            //var documents = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
            //pathToDatabase = Path.Combine(documents, "db_adonet.db");
            comp = DataHelper.GetCompany(pathToDatabase);
            //SqliteConnection.CreateFile(pathToDatabase);
            using (var db = new SQLite.SQLiteConnection(pathToDatabase))
            {
                var list1 = db.Table <CNNote>().Where(x => x.cnno == invno).ToList <CNNote>();
                var list2 = db.Table <CNNoteDtls>().Where(x => x.cnno == invno).ToList <CNNoteDtls>();
                var list3 = db.Table <Trader>().Where(x => x.CustCode == CUSTCODE).ToList <Trader>();

                double ttlamt = 0;
                double ttltax = 0;
                if (list3.Count > 0)
                {
                    CUSTNAME = list3 [0].CustName;
                }
                foreach (var item in list2)
                {
                    ttlamt = ttlamt + item.netamount;
                    ttltax = ttltax + item.tax;
                    list.Add(item);
                }
                if (list1.Count > 0)
                {
                    list1 [0].amount = ttlamt;
                    db.Update(list1 [0]);
                }
//				CNNoteDtls inv1 = new CNNoteDtls ();
//				inv1.icode = "TAX";
//				inv1.netamount = ttltax;
//				CNNoteDtls inv2 = new CNNoteDtls ();
//				inv2.icode = "AMOUNT";
//				inv2.netamount = ttlamt;
//
//				list.Add (inv1);
//				list.Add (inv2);

                double     roundVal = 0;
                double     ttlNet   = Utility.AdjustToNear(ttlamt + ttltax, ref roundVal);
                CNNoteDtls inv1     = new CNNoteDtls();
                inv1.icode       = "TAX";
                inv1.netamount   = ttlamt;
                inv1.description = "TOTAL EXCL GST";
                CNNoteDtls inv2 = new CNNoteDtls();
                inv2.icode       = "AMOUNT";
                inv2.netamount   = ttltax;
                inv2.description = "TOTAL 6% GST";
                CNNoteDtls inv3 = new CNNoteDtls();
                inv3.icode       = "TAX";
                inv3.netamount   = ttlamt + ttltax;
                inv3.description = "TOTAL INCL GST";
                CNNoteDtls inv4 = new CNNoteDtls();
                inv4.icode       = "AMOUNT";
                inv4.netamount   = roundVal;
                inv4.description = "ROUNDING ADJUST";
                CNNoteDtls inv5 = new CNNoteDtls();
                inv5.icode       = "AMOUNT";
                inv5.netamount   = ttlNet;
                inv5.description = "NET TOTAL";


                list.Add(inv1);
                list.Add(inv2);
                list.Add(inv3);
                if (invno.IndexOf("(CS)") > -1)
                {
                    list.Add(inv4);
                    list.Add(inv5);
                }
            }
        }