Пример #1
0
 public PrintESCPSBase()
 {
     pathToDatabase = ((GlobalvarsApp)Application.Context).DATABASE_PATH;
     USERID         = ((GlobalvarsApp)Application.Context).USERID_CODE;
     apara          = DataHelper.GetAdPara(pathToDatabase);
     compInfo       = DataHelper.GetCompany(pathToDatabase);
 }
Пример #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            if (!((GlobalvarsApp)this.Application).ISLOGON)
            {
                Finish();
            }
            SetTitle(Resource.String.submenu_summary);
            SetContentView(Resource.Layout.PrintInvSumm);
            pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH;
            apara          = DataHelper.GetAdPara(pathToDatabase);
            Button   butPrint   = FindViewById <Button> (Resource.Id.printsumm);
            Button   butInvBack = FindViewById <Button> (Resource.Id.printsumm_cancel);
            EditText frd        = FindViewById <EditText> (Resource.Id.trxdatefr);
            EditText tod        = FindViewById <EditText> (Resource.Id.trxdateto);

            imm        = (InputMethodManager)GetSystemService(Context.InputMethodService);
            frd.Text   = DateTime.Today.ToString("dd-MM-yyyy");
            frd.Click += delegate(object sender, EventArgs e) {
                imm.HideSoftInputFromWindow(frd.WindowToken, 0);
                ShowDialog(DATE_DIALOG_ID1);
            };
            tod.Text   = DateTime.Today.ToString("dd-MM-yyyy");
            date       = DateTime.Today;
            tod.Click += delegate(object sender, EventArgs e) {
                imm.HideSoftInputFromWindow(tod.WindowToken, 0);
                ShowDialog(DATE_DIALOG_ID2);
            };
            butInvBack.Click += (object sender, EventArgs e) => {
                StartActivity(typeof(TransListActivity));
            };
            butPrint.Click += ButPrint_Click;
        }
Пример #3
0
        void DownlooadLogo()
        {
            try {
                //backup db first before upload
                AdPara    apara       = DataHelper.GetAdPara(pathToDatabase);
                WebClient myWebClient = new WebClient();
                string    document    = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
                string    logopath    = "";
                string    filename    = "";
                if (apara.PaperSize == "58mm")
                {
                    logopath = Path.Combine(document, "logo58.png");
                    filename = COMPCODE + "_" + BRANCODE + "_58_logo.png";
                }
                else
                {
                    logopath = Path.Combine(document, "logo80.png");
                    filename = COMPCODE + "_" + BRANCODE + "_80_logo.png";
                }
                string url = WCFHelper.GetDownloadLogoUrl() + filename;
//				string localfilename = Path.Combine (sdcard, "logo.png");
                if (File.Exists(logopath))
                {
                    File.Delete(logopath);
                }

                myWebClient.DownloadFile(url, logopath);
                //File.Copy (localfilename, logopath, true);

//				Toast.MakeText (this, Resources.GetString (Resource.String.msg_successdownlogo), ToastLength.Long).Show ();
            } catch (Exception ex) {
                Toast.MakeText(this, Resources.GetString(Resource.String.msg_faildowndb), ToastLength.Long).Show();
            }
        }
Пример #4
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            if (!((GlobalvarsApp)this.Application).ISLOGON)
            {
                Finish();
            }
            // Create your application here
            SetTitle(Resource.String.title_so);
            SetContentView(Resource.Layout.ListView);
            pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH;
            rights         = Utility.GetAccessRights(pathToDatabase);
            populate(listData);
            apara    = DataHelper.GetAdPara(pathToDatabase);
            listView = FindViewById <ListView> (Resource.Id.feedList);
//			TableLayout tlay = FindViewById<TableLayout> (Resource.Id.tableLayout1);
//			tlay.Visibility = ViewStates.Invisible;
            Button butNew = FindViewById <Button> (Resource.Id.butnewInv);

            butNew.Visibility = ViewStates.Invisible;
            Button butInvBack = FindViewById <Button> (Resource.Id.butInvBack);

            butInvBack.Click += (object sender, EventArgs e) => {
                StartActivity(typeof(TransListActivity));
            };

            listView.ItemClick     += OnListItemClick;
            listView.ItemLongClick += OnListItemLongClick;
            //listView.Adapter = new CusotmListAdapter(this, listData);
            SetViewDlg viewdlg = SetViewDelegate;

            listView.Adapter = new GenericListAdapter <SaleOrder> (this, listData, Resource.Layout.ListItemRow, viewdlg);
        }
Пример #5
0
        public static IPrintDocument GetPrintDocument <T>()
        {
            //string USERDEFINE = ((GlobalvarsApp)Application.Context).USERFUNCTION;
            string         pathToDatabase = ((GlobalvarsApp)Application.Context).DATABASE_PATH;
            IPrintDocument intent         = null;
            string         classname      = "";

            AdPara para = DataHelper.GetAdPara(pathToDatabase);

            if (para.PaperSize == "8.5Inch")
            {
                if (para.PrinterType == "Network Laserjet Printer")
                {
                    intent = GetPrintDocumentEX <PrintPCLInvoice> ();
                }
                else
                {
                    intent = GetPrintDocumentEX <PrintDMInvoice> ();
                }
            }
            else
            {
                intent = GetPrintDocumentEX <T> ();
            }

            return(intent);
        }
Пример #6
0
        void CreateNewInv()
        {
            DateTime  invdate = Utility.ConvertToDate(txtInvDate.Text);
            DateTime  tmr     = invdate.AddDays(1);
            AdNumDate adNum;            // = DataHelper.GetNumDate (pathToDatabase, invdate);

            apara = DataHelper.GetAdPara(pathToDatabase);
            string[] prefixs = apara.Prefix.Trim().ToUpper().Split(new char[] { '|' });
            string   prefix  = "";

            adNum = DataHelper.GetNumDate(pathToDatabase, invdate, "INV");
            if (prefixs.Length > 1)
            {
                prefix = prefixs [0];
            }
            else
            {
                prefix = prefixs [0];
            }

            invno = "";
            int runno        = adNum.RunNo + 1;
            int currentRunNo = DataHelper.GetLastInvRunNo(pathToDatabase, invdate, "INVOICE");

            if (currentRunNo >= runno)
            {
                runno = currentRunNo + 1;
            }

            invno = prefix + invdate.ToString("yyMM") + runno.ToString().PadLeft(4, '0');

            using (var db = new SQLite.SQLiteConnection(pathToDatabase)) {
                inv            = new Invoice();
                inv.invno      = invno;
                inv.invdate    = invdate;
                inv.trxtype    = "INVOICE";
                inv.created    = DateTime.Now;
                inv.amount     = 0;
                inv.isUploaded = false;
                inv.remark     = "";
                db.Insert(inv);
                adNum.RunNo = runno;
                if (adNum.ID >= 0)
                {
                    db.Update(adNum);
                }
                else
                {
                    db.Insert(adNum);
                }
            }
            txtInvNo.Text   = inv.invno;
            txtInvDate.Text = inv.invdate.ToString("dd-MM-yyyy");
            txtInvMode.Text = "NEW";
            IsSave          = false;
            IsFirePaid      = false;
            IsFirePaidOnly  = false;
            EnableControLs(true, true, false, true, false);
        }
Пример #7
0
        protected override void OnResume()
        {
            base.OnResume();
            listData = new List <CNNote> ();
            populate(listData);
            apara    = DataHelper.GetAdPara(pathToDatabase);
            listView = FindViewById <ListView> (Resource.Id.feedList);
            SetViewDlg viewdlg = SetViewDelegate;

            listView.Adapter = new GenericListAdapter <CNNote> (this, listData, Resource.Layout.ListItemRowCN, viewdlg);
        }
Пример #8
0
        protected override void OnResume()
        {
            base.OnResume();
            listData       = new List <Invoice> ();
            pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH;
            COMPCODE       = ((GlobalvarsApp)this.Application).COMPANY_CODE;
            rights         = Utility.GetAccessRights(pathToDatabase);
            populate(listData);
            apara    = DataHelper.GetAdPara(pathToDatabase);
            listView = FindViewById <ListView> (Resource.Id.feedList);
            SetViewDlg viewdlg = SetViewDelegate;

            listView.Adapter = new GenericListAdapter <Invoice> (this, listData, Resource.Layout.ListItemRow, viewdlg);
        }
Пример #9
0
        protected override void OnResume()
        {
            base.OnResume();
            if (txtSearch.Text != "")
            {
                FindItemByText();
                return;
            }
            listData = new List <Invoice> ();
            populate(listData);
            apara    = DataHelper.GetAdPara(pathToDatabase);
            listView = FindViewById <ListView> (Resource.Id.CustList);
            SetViewDlg viewdlg = SetViewDelegate;

            listView.Adapter = new GenericListAdapter <Invoice> (this, listData, Resource.Layout.ListItemRow, viewdlg);
        }
Пример #10
0
        public static IPrintToDevice GetPrintingDevice <T>()
        {
            string         USERDEFINE     = ((GlobalvarsApp)Application.Context).USERFUNCTION;
            string         pathToDatabase = ((GlobalvarsApp)Application.Context).DATABASE_PATH;
            IPrintToDevice intent         = null;
            AdPara         para           = DataHelper.GetAdPara(pathToDatabase);

            if (para.PrinterType == "Network POS Printer")
            {
                intent = GetPrintingDeviceEx <TCPDeviceHelper> ();
            }
            else
            {
                intent = GetPrintingDeviceEx <T> ();
            }
            return(intent);
        }
Пример #11
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            if (!((GlobalvarsApp)this.Application).ISLOGON)
            {
                Finish();
            }
            SetTitle(Resource.String.submenu_invlist);
            EventManagerFacade.Instance.GetEventManager().AddListener(this);
            // Create your application here
            SetContentView(Resource.Layout.ListCustView);
            pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH;
            rights         = Utility.GetAccessRights(pathToDatabase);
            TRXTYPE        = Intent.GetStringExtra("trxtype") ?? "CASH";

            Utility.GetDateRange(ref sdate, ref edate);
            populate(listData);
            apara = DataHelper.GetAdPara(pathToDatabase);
            //listView = FindViewById<ListView> (Resource.Id.feedList); //CustList
            listView = FindViewById <ListView> (Resource.Id.CustList);            //CustList
//			TableLayout tlay = FindViewById<TableLayout> (Resource.Id.tableLayout1);
//			tlay.Visibility = ViewStates.Invisible;
            //Button butNew= FindViewById<Button> (Resource.Id.butnewInv);
            //butNew.Visibility = ViewStates.Invisible;
            txtSearch = FindViewById <EditText> (Resource.Id.txtSearch);

            //Button butInvBack= FindViewById<Button> (Resource.Id.butInvBack);
            Button butInvBack = FindViewById <Button> (Resource.Id.butCustBack);

            butInvBack.Click += (object sender, EventArgs e) => {
                StartActivity(typeof(TransListActivity));
            };

            listView.ItemClick     += OnListItemClick;
            listView.ItemLongClick += OnListItemLongClick;
            //listView.Adapter = new CusotmListAdapter(this, listData);
            SetViewDlg viewdlg = SetViewDelegate;

            listView.Adapter       = new GenericListAdapter <Invoice> (this, listData, Resource.Layout.ListItemRow, viewdlg);
            txtSearch.TextChanged += TxtSearch_TextChanged;
        }
Пример #12
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            if (!((GlobalvarsApp)this.Application).ISLOGON)
            {
                Finish();
            }

            SetTitle(Resource.String.title_invoice);

            // Create your application here
            SetContentView(Resource.Layout.ListView);
            pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH;
            COMPCODE       = ((GlobalvarsApp)this.Application).COMPANY_CODE;
            rights         = Utility.GetAccessRights(pathToDatabase);
            populate(listData);
            apara    = DataHelper.GetAdPara(pathToDatabase);
            listView = FindViewById <ListView> (Resource.Id.feedList);
            Button butNew = FindViewById <Button> (Resource.Id.butnewInv);

            butNew.Visibility = ViewStates.Gone;
            //butNew.Click += butCreateNewInv;
            Button butInvBack = FindViewById <Button> (Resource.Id.butInvBack);

            butInvBack.Click += (object sender, EventArgs e) => {
                StartActivity(typeof(InvoiceActivityEx));
            };

            //if (!rights.InvAllowAdd)
            //	butNew.Enabled = false;

            listView.ItemClick     += OnListItemLongClick;        //OnListItemClick;
            listView.ItemLongClick += ListView_ItemLongClick;
            //listView.Adapter = new CusotmListAdapter(this, listData);
            SetViewDlg viewdlg = SetViewDelegate;

            listView.Adapter = new GenericListAdapter <Invoice> (this, listData, Resource.Layout.ListItemRow, viewdlg);
        }
Пример #13
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            if (!((GlobalvarsApp)this.Application).ISLOGON)
            {
                Finish();
            }
            SetTitle(Resource.String.title_donew);
            SetContentView(Resource.Layout.CreateDO);
            EventManagerFacade.Instance.GetEventManager().AddListener(this);
            pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH;
            compcode       = ((GlobalvarsApp)this.Application).COMPANY_CODE;
            apara          = DataHelper.GetAdPara(pathToDatabase);
            rights         = Utility.GetAccessRights(pathToDatabase);

            // Create your application here
            _date   = DateTime.Today;
            spinner = FindViewById <Spinner> (Resource.Id.newinv_custcode);
            Spinner  spinnerType = FindViewById <Spinner> (Resource.Id.newinv_type);
            Button   butSave     = FindViewById <Button> (Resource.Id.newinv_bsave);
            Button   butNew      = FindViewById <Button> (Resource.Id.newinv_cancel);
            Button   butFind     = FindViewById <Button> (Resource.Id.newinv_bfind);
            EditText remark      = FindViewById <EditText> (Resource.Id.newinv_custname);

            spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected);
            butSave.Click        += butSaveClick;
            butNew.Click         += butCancelClick;
            TextView invno = FindViewById <TextView> (Resource.Id.newinv_no);

            invno.Text = "AUTO";
            EditText trxdate = FindViewById <EditText> (Resource.Id.newinv_date);

            trxdate.Text = _date.ToString("dd-MM-yyyy");
//			trxdate.Click += delegate(object sender, EventArgs e) {
//				ShowDialog (0);
//			};
            if (rights.DOEditTrxDate)
            {
                trxdate.Click += delegate(object sender, EventArgs e) {
                    ShowDialog(0);
                };
            }
            else
            {
                trxdate.Enabled = false;
            }
            butFind.Click += (object sender, EventArgs e) => {
                ShowCustLookUp();
            };


            //SqliteConnection.CreateFile(pathToDatabase);
            using (var db = new SQLite.SQLiteConnection(pathToDatabase))
            {
                items = db.Table <Trader> ().ToList <Trader> ();
            }

            List <string> icodes = new List <string> ();

            foreach (Trader item in items)
            {
                icodes.Add(item.CustCode + " | " + item.CustName);
            }

            dataAdapter2 = ArrayAdapter.CreateFromResource(
                this, Resource.Array.term, Resource.Layout.spinner_item);


            dataAdapter = new ArrayAdapter <String> (this, Resource.Layout.spinner_item, icodes);
            dataAdapter.SetDropDownViewResource(Resource.Layout.SimpleSpinnerDropDownItemEx);
            dataAdapter2.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinner.Adapter     = dataAdapter;
            spinnerType.Adapter = dataAdapter2;

            remark.RequestFocus();
        }
Пример #14
0
 public TCPDotMatrixHelper()
 {
     pathToDatabase = ((GlobalvarsApp)Application.Context).DATABASE_PATH;
     apara          = DataHelper.GetAdPara(pathToDatabase);
 }
Пример #15
0
        //AccessRights rights;

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            if (!((GlobalvarsApp)this.Application).ISLOGON)
            {
                Finish();
            }
            SetTitle(Resource.String.title_sonew);
            SetContentView(Resource.Layout.CreateSO);
            EventManagerFacade.Instance.GetEventManager().AddListener(this);

            pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH;
            //rights = Utility.GetAccessRights (pathToDatabase);
            apara = DataHelper.GetAdPara(pathToDatabase);

            // Create your application here
            _date       = DateTime.Today;
            spinner     = FindViewById <Spinner> (Resource.Id.newinv_custcode);
            spinnerBill = FindViewById <Spinner> (Resource.Id.newinv_billto);
            TextView lbBillto = FindViewById <TextView> (Resource.Id.lbbillto);

            lbBillto.Text = "PAY FROM";

            Button butSave     = FindViewById <Button> (Resource.Id.newinv_bsave);
            Button butNew      = FindViewById <Button> (Resource.Id.newinv_cancel);
            Button butFind     = FindViewById <Button> (Resource.Id.newinv_bfind);
            Button butBillFind = FindViewById <Button> (Resource.Id.newinv_billfind);

            //spinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected);
            //spinnerBill.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected);
            butSave.Click += butSaveClick;
            butNew.Click  += butCancelClick;
            TextView invno = FindViewById <TextView> (Resource.Id.newinv_no);

            invno.Text = "AUTO";
            EditText trxdate = FindViewById <EditText> (Resource.Id.newinv_date);

            trxdate.Text   = _date.ToString("dd-MM-yyyy");
            trxdate.Click += delegate(object sender, EventArgs e) {
                ShowDialog(0);
            };
            butFind.Click += (object sender, EventArgs e) => {
                ShowCustLookUp();
            };
            butBillFind.Click += (object sender, EventArgs e) => {
                ShowBillToLookUp();
            };


            //SqliteConnection.CreateFile(pathToDatabase);
            using (var db = new SQLite.SQLiteConnection(pathToDatabase))
            {
                items = db.Table <Trader> ().ToList <Trader> ();
            }

            var icodes  = GetCustCode(IsValidCustTo);
            var icodes2 = GetCustCode(IsValidBillTo);

            dataAdapter = new ArrayAdapter <String> (this, Resource.Layout.spinner_item, icodes);
            dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinner.Adapter = dataAdapter;

            dataAdapter2 = new ArrayAdapter <String> (this, Resource.Layout.spinner_item, icodes2);
            dataAdapter2.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinnerBill.Adapter = dataAdapter2;
        }
Пример #16
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            if (!((GlobalvarsApp)this.Application).ISLOGON)
            {
                Finish();
            }
            SetTitle(Resource.String.title_doedit);
            SetContentView(Resource.Layout.CreateDO);
            pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH;
            EventManagerFacade.Instance.GetEventManager().AddListener(this);

            DONO   = Intent.GetStringExtra("dono") ?? "AUTO";
            doInfo = DataHelper.GetDO(pathToDatabase, DONO);
            if (doInfo == null)
            {
                base.OnBackPressed();
            }
            // Create your application here
            _date   = DateTime.Today;
            spinner = FindViewById <Spinner> (Resource.Id.newinv_custcode);
            Spinner  spinnerType = FindViewById <Spinner> (Resource.Id.newinv_type);
            Button   butSave     = FindViewById <Button> (Resource.Id.newinv_bsave);
            Button   butNew      = FindViewById <Button> (Resource.Id.newinv_cancel);
            Button   butFind     = FindViewById <Button> (Resource.Id.newinv_bfind);
            EditText remark      = FindViewById <EditText> (Resource.Id.newinv_custname);

            spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected);
            butSave.Click        += butSaveClick;
            butNew.Click         += butCancelClick;
            TextView invno   = FindViewById <TextView> (Resource.Id.newinv_no);
            EditText trxdate = FindViewById <EditText> (Resource.Id.newinv_date);

//          trxdate.Click += delegate(object sender, EventArgs e) {
//				ShowDialog (0);
//			};
            //19-Nov-2015
            //disable the date, for edit mode, date should not be editable
            //cuase running number issue.
            trxdate.Enabled = false;
            butFind.Click  += (object sender, EventArgs e) => {
                ShowCustLookUp();
            };


            apara = DataHelper.GetAdPara(pathToDatabase);
            //SqliteConnection.CreateFile(pathToDatabase);
            using (var db = new SQLite.SQLiteConnection(pathToDatabase))
            {
                items = db.Table <Trader> ().ToList <Trader> ();
            }

            List <string> icodes = new List <string> ();

            foreach (Trader item in items)
            {
                icodes.Add(item.CustCode + " | " + item.CustName.Trim());
            }

            dataAdapter2 = ArrayAdapter.CreateFromResource(
                this, Resource.Array.term, Resource.Layout.spinner_item);


            dataAdapter = new ArrayAdapter <String> (this, Resource.Layout.spinner_item, icodes);
            dataAdapter.SetDropDownViewResource(Resource.Layout.SimpleSpinnerDropDownItemEx);
            dataAdapter2.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinner.Adapter     = dataAdapter;
            spinnerType.Adapter = dataAdapter2;

            remark.RequestFocus();
            LoadData();
        }
Пример #17
0
 public BlueToothDeviceHelper()
 {
     pathToDatabase = ((GlobalvarsApp)Application.Context).DATABASE_PATH;
     apara          = DataHelper.GetAdPara(pathToDatabase);
 }
Пример #18
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            if (!((GlobalvarsApp)this.Application).ISLOGON)
            {
                Finish();
            }
            SetTitle(Resource.String.title_soedit);
            SetContentView(Resource.Layout.CreateSO);
            EventManagerFacade.Instance.GetEventManager().AddListener(this);
            pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH;
            SONO           = Intent.GetStringExtra("sono") ?? "AUTO";
            soInfo         = DataHelper.GetSO(pathToDatabase, SONO);
            if (soInfo == null)
            {
                base.OnBackPressed();
            }

            //rights = Utility.GetAccessRights (pathToDatabase);
            apara = DataHelper.GetAdPara(pathToDatabase);

            // Create your application here
            _date       = DateTime.Today;
            spinner     = FindViewById <Spinner> (Resource.Id.newinv_custcode);
            spinnerBill = FindViewById <Spinner> (Resource.Id.newinv_billto);

            Button butSave = FindViewById <Button> (Resource.Id.newinv_bsave);

            butSave.Text = Resources.GetString(Resource.String.but_save);            // "SAVE";
            Button butNew      = FindViewById <Button> (Resource.Id.newinv_cancel);
            Button butFind     = FindViewById <Button> (Resource.Id.newinv_bfind);
            Button butBillFind = FindViewById <Button> (Resource.Id.newinv_billfind);

            //spinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected);
            //spinnerBill.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected);
            butSave.Click += butSaveClick;
            butNew.Click  += butCancelClick;
            EditText trxdate = FindViewById <EditText> (Resource.Id.newinv_date);

            //trxdate.Text = _date.ToString ("dd-MM-yyyy");
//			trxdate.Click += delegate(object sender, EventArgs e) {
//				ShowDialog (0);
//			};
            //19-Nov-2015
            //disable the date, for edit mode, date should not be editable
            //cuase running number issue.
            trxdate.Enabled = false;

            butFind.Click += (object sender, EventArgs e) => {
                ShowCustLookUp();
            };
            butBillFind.Click += (object sender, EventArgs e) => {
                ShowBillToLookUp();
            };


            //SqliteConnection.CreateFile(pathToDatabase);
            using (var db = new SQLite.SQLiteConnection(pathToDatabase))
            {
                items = db.Table <Trader> ().ToList <Trader> ();
            }

            icodes  = GetCustCode(IsValidCustTo);
            icodes2 = GetCustCode(IsValidBillTo);

            dataAdapter = new ArrayAdapter <String> (this, Resource.Layout.spinner_item, icodes);
            dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinner.Adapter = dataAdapter;

            dataAdapter2 = new ArrayAdapter <String> (this, Resource.Layout.spinner_item, icodes2);
            dataAdapter2.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinnerBill.Adapter = dataAdapter2;

            LoadData();
        }
Пример #19
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            if (!((GlobalvarsApp)this.Application).ISLOGON)
            {
                Finish();
            }
            SetTitle(Resource.String.title_creditnoteedit);
            SetContentView(Resource.Layout.CreateCNote);
            EventManagerFacade.Instance.GetEventManager().AddListener(this);
            pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH;

            CNNO   = Intent.GetStringExtra("cnno") ?? "AUTO";
            cnInfo = DataHelper.GetCNNote(pathToDatabase, CNNO);

            // Create your application here
            _date   = DateTime.Today;
            spinner = FindViewById <Spinner> (Resource.Id.newinv_custcode);

            Button butSave = FindViewById <Button> (Resource.Id.newinv_bsave);

            butSave.Text = "SAVE";
            Button butCancel  = FindViewById <Button> (Resource.Id.newinv_cancel);
            Button butFind    = FindViewById <Button> (Resource.Id.newinv_bfind);
            Button butFindInv = FindViewById <Button> (Resource.Id.newinv_bfindinv);

            spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected);
            butSave.Click        += butSaveClick;
            butCancel.Click      += butCancelClick;
            TextView cnno = FindViewById <TextView> (Resource.Id.newinv_no);

            cnno.Enabled = false;
            EditText trxdate = FindViewById <EditText> (Resource.Id.newinv_date);

//			trxdate.Click += delegate(object sender, EventArgs e) {
//				ShowDialog (0);
//			};
            //19-Nov-2015
            //disable the date, for edit mode, date should not be editable
            //cuase running number issue.
            trxdate.Enabled = false;

            butFind.Click += (object sender, EventArgs e) => {
                ShowCustLookUp();
            };

            butFindInv.Click += (object sender, EventArgs e) => {
                ShowInvLookUp();
            };


            apara = DataHelper.GetAdPara(pathToDatabase);
            //SqliteConnection.CreateFile(pathToDatabase);
            using (var db = new SQLite.SQLiteConnection(pathToDatabase))
            {
                items = db.Table <Trader> ().ToList <Trader> ();
            }

            List <string> icodes = new List <string> ();

            foreach (Trader item in items)
            {
                icodes.Add(item.CustCode + " | " + item.CustName.Trim());
            }
            dataAdapter = new ArrayAdapter <String>(this, Resource.Layout.spinner_item, icodes);
            // Drop down layout style - list view with radio button
            //dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            dataAdapter.SetDropDownViewResource(Resource.Layout.SimpleSpinnerDropDownItemEx);
            // attaching data adapter to spinner
            spinner.Adapter = dataAdapter;
            LoadData();
        }
Пример #20
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            if (!((GlobalvarsApp)this.Application).ISLOGON)
            {
                Finish();
            }
            INVOICENO = Intent.GetStringExtra("invoiceno") ?? "AUTO";
            TRXTYPE   = Intent.GetStringExtra("trxtype") ?? "CASH";
            if (TRXTYPE == "CASH")
            {
                SetTitle(Resource.String.title_cashedit);
            }
            else
            {
                SetTitle(Resource.String.title_invoiceedit);
            }
            SetContentView(Resource.Layout.CreateInvoice);
            EventManagerFacade.Instance.GetEventManager().AddListener(this);
            pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH;
            rights         = Utility.GetAccessRights(pathToDatabase);


            invInfo = DataHelper.GetInvoice(pathToDatabase, INVOICENO);
            if (invInfo == null)
            {
                base.OnBackPressed();
            }
            // Create your application here

            spinner     = FindViewById <Spinner> (Resource.Id.newinv_custcode);
            spinnerType = FindViewById <Spinner> (Resource.Id.newinv_type);
            Button butSave = FindViewById <Button> (Resource.Id.newinv_bsave);

            butSave.Text = Resources.GetString(Resource.String.but_save);            // "SAVE";
            Button butCancel = FindViewById <Button> (Resource.Id.newinv_cancel);
            Button butFind   = FindViewById <Button> (Resource.Id.newinv_bfind);

            spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected);

            butSave.Click      += butSaveClick;
            butCancel.Click    += butCancelClick;
            spinnerType.Enabled = false;

            EditText trxdate = FindViewById <EditText> (Resource.Id.newinv_date);

//			trxdate.Click += delegate(object sender, EventArgs e) {
//				ShowDialog (0);
//			};
            //19-Nov-2015
            //disable the date, for edit mode, date should not be editable
            //cuase running number issue.
            trxdate.Enabled = false;

            butFind.Click += (object sender, EventArgs e) => {
                ShowCustLookUp();
            };


            apara = DataHelper.GetAdPara(pathToDatabase);
            LoadTrader();

            List <string> icodes  = new List <string> ();
            int           counter = 0;

            foreach (Trader item in custs)
            {
                icodes.Add(item.CustCode + " | " + item.CustName.Trim());
                if (item.CustCode.Trim() == "COD" || item.CustCode.Trim() == "CASH")
                {
                    CashPos = counter;
                }
                counter += 1;
            }

            dataAdapter  = new ArrayAdapter <String> (this, Resource.Layout.spinner_item, icodes);
            dataAdapter2 = ArrayAdapter.CreateFromResource(
                this, Resource.Array.trxtype, Resource.Layout.spinner_item);

            //dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            dataAdapter.SetDropDownViewResource(Resource.Layout.SimpleSpinnerDropDownItemEx);
            dataAdapter2.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);

            // attaching data adapter to spinner
            spinner.Adapter     = dataAdapter;
            spinnerType.Adapter = dataAdapter2;
            LoadData();
        }