public void PrintDOHeader(ref string test,DelOrder doOrder) { string userid = USERID; string title1 = "DELIVERY ORDER"; string date = doOrder.dodate.ToString ("dd-MM-yyyy"); //string datetime = doOrder.dodate.ToString ("dd-MM-yyyy hh:mm tt"); string datetime = doOrder.dodate.ToString ("dd-MM-yyyy")+" "+doOrder.created.ToString ("hh:mm tt"); if (compinfo.ShowTime) { test += datetime+title1.PadLeft(41-datetime.Length,' ')+"\n"; } else { test += date+title1.PadLeft(41-date.Length,' ')+"\n"; } string recno = "DELIVERY ORDER NO : " + doOrder.dono.Trim(); test += recno+"\n"; string issueline = "ISSUED BY: " + userid.ToUpper (); string term = "TERM : " + doOrder.term.ToUpper(); issueline = issueline +"\n"; test += issueline;// "ISSUED BY: " + userid.ToUpper()+"\n"; test += term +"\n"; if (!string.IsNullOrEmpty (doOrder.remark)) { string reason = "REMARK: " + doOrder.remark; PrintLongText (ref test, reason); } test += "------------------------------------------\n"; test += "NO DESCRIPTION QTY \n"; test += "------------------------------------------\n"; // 1234 // 12345678901234567890123456789012312345 // }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish (); } SetContentView (Resource.Layout.CreateDO); EventManagerFacade.Instance.GetEventManager().AddListener(this); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; compCode = ((GlobalvarsApp)this.Application).COMPANY_CODE; branchCode = ((GlobalvarsApp)this.Application).BRANCH_CODE; DONO = Intent.GetStringExtra ("dono") ?? "AUTO"; doInfo =DataHelper.GetDelOrder (pathToDatabase, DONO, compCode, branchCode); if (doInfo == null) { base.OnBackPressed (); } // Create your application here _date = DateTime.Today; spinner = FindViewById<Spinner> (Resource.Id.newinv_custcode); Button butSave = FindViewById<Button> (Resource.Id.newinv_bsave); Button butCancel = FindViewById<Button> (Resource.Id.newinv_cancel); Button butFind = FindViewById<Button> (Resource.Id.newinv_bfind); butSave.Text = "SAVE"; spinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected); butSave.Click += butSaveClick; butCancel.Click += butCancelClick; TextView invno = FindViewById<TextView> (Resource.Id.newinv_no); invno.Enabled = false; EditText trxdate = FindViewById<EditText> (Resource.Id.newinv_date); trxdate.Click += delegate(object sender, EventArgs e) { ShowDialog (0); }; butFind.Click+= (object sender, EventArgs e) => { ShowCustLookUp(); }; apara = DataHelper.GetAdPara (pathToDatabase,compCode,branchCode); //SqliteConnection.CreateFile(pathToDatabase); using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { items = db.Table<Trader> ().Where(x=>x.CompCode==compCode&&x.BranchCode==branchCode).ToList<Trader> (); } List<string> icodes = new List<string> (); foreach (Trader item in items) { icodes.Add (item.CustCode+" | "+item.CustName); } dataAdapter = new ArrayAdapter<String> (this, Resource.Layout.spinner_item, icodes); dataAdapter.SetDropDownViewResource(Resource.Layout.SimpleSpinnerDropDownItemEx); spinner.Adapter =dataAdapter; LoadData (); }
private void GetDelOrderText(DelOrder delOrder, DelOrderDtls[] list) { prtcompHeader.PrintCompHeader (ref text); prtCustHeader.PrintCustomer (ref text, delOrder.custcode,"DELIVER TO"); prtHeader.PrintDOHeader (ref text, delOrder); string dline = ""; double ttlAmt = 0; double ttltax = 0; int count = 0; foreach (DelOrderDtls itm in list) { count += 1; dline = dline + prtDetail.PrintDODetail (itm, count); ttlAmt = ttlAmt + itm.qty; } text += dline; prtTotal.PrintDOTotal(ref text, ttlAmt); prtFooter.PrintFooter (ref text); text += "\nTHANK YOU\n\n\n\n\n\n\n\n"; }
private void GetDelOrderText(DelOrder delOrder, DelOrderDtls[] list) { prtcompHeader.PrintCompHeader(ref text); prtCustHeader.PrintCustomer(ref text, delOrder.custcode, "DELIVER TO"); prtHeader.PrintDOHeader(ref text, delOrder); string dline = ""; double ttlAmt = 0; double ttltax = 0; int count = 0; foreach (DelOrderDtls itm in list) { count += 1; dline = dline + prtDetail.PrintDODetail(itm, count); ttlAmt = ttlAmt + itm.qty; } text += dline; prtTotal.PrintDOTotal(ref text, ttlAmt); prtFooter.PrintFooter(ref text); text += "\nTHANK YOU\n\n\n\n\n\n\n\n"; }
void OnListItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e) { DelOrder item = listData.ElementAt(e.Position); PopupMenu menu = new PopupMenu(e.Parent.Context, e.View); menu.Inflate(Resource.Menu.popupHis); if (!rights.DOAllowPrint) { menu.Menu.RemoveItem(Resource.Id.popInvprint); menu.Menu.RemoveItem(Resource.Id.popInvprint2); } menu.MenuItemClick += (s1, arg1) => { if (arg1.Item.TitleFormatted.ToString().ToLower() == "print") { PrintInv(item, 1); } else if (arg1.Item.TitleFormatted.ToString().ToLower() == "print 2 copy") { PrintInv(item, 2); } }; menu.Show(); }
private void SetViewDelegate(View view, object clsobj) { DelOrder item = (DelOrder)clsobj; view.FindViewById <TextView> (Resource.Id.invdate).Text = item.dodate.ToString("dd-MM-yy"); view.FindViewById <TextView> (Resource.Id.invno).Text = item.dono; view.FindViewById <TextView> (Resource.Id.trxtype).Text = ""; view.FindViewById <TextView>(Resource.Id.invcust).Text = item.description; //view.FindViewById<TextView> (Resource.Id.Amount).Text = item.amount.ToString("n2"); view.FindViewById <TextView> (Resource.Id.TaxAmount).Text = ""; view.FindViewById <TextView> (Resource.Id.TtlAmount).Text = item.amount.ToString("n");; ImageView img = view.FindViewById <ImageView> (Resource.Id.printed); if (!item.isPrinted) { img.Visibility = ViewStates.Invisible; } if (!string.IsNullOrEmpty(item.remark)) { view.FindViewById <LinearLayout> (Resource.Id.linearLayoutRmark).Visibility = ViewStates.Visible; view.FindViewById <TextView> (Resource.Id.invremark).Text = item.remark.ToUpper(); } }
public void PrintDOHeader(ref string test, DelOrder doOrder) { string userid = USERID; string title1 = "DELIVERY ORDER"; string date = doOrder.dodate.ToString("dd-MM-yyyy"); //string datetime = doOrder.dodate.ToString ("dd-MM-yyyy hh:mm tt"); string datetime = doOrder.dodate.ToString("dd-MM-yyyy") + " " + doOrder.created.ToString("hh:mm tt"); if (compinfo.ShowTime) { test += datetime + title1.PadLeft(41 - datetime.Length, ' ') + "\n"; } else { test += date + title1.PadLeft(41 - date.Length, ' ') + "\n"; } string recno = "DELIVERY ORDER NO : " + doOrder.dono.Trim(); test += recno + "\n"; string issueline = "ISSUED BY: " + userid.ToUpper(); string term = "TERM : " + doOrder.term.ToUpper(); issueline = issueline + "\n"; test += issueline; // "ISSUED BY: " + userid.ToUpper()+"\n"; test += term + "\n"; if (!string.IsNullOrEmpty(doOrder.remark)) { string reason = "REMARK: " + doOrder.remark; PrintLongText(ref test, reason); } test += "------------------------------------------\n"; test += "NO DESCRIPTION QTY \n"; test += "------------------------------------------\n"; // 1234 // 12345678901234567890123456789012312345 // }
void Edit(DelOrder doorder) { //var intent = new Intent (this, typeof(EditInvoice)); var intent =ActivityManager.GetActivity<EditDelOrder>(this.ApplicationContext); intent.PutExtra ("dono", doorder.dono); StartActivity (intent); }
private void CreateNewDO() { DelOrder dorder = new DelOrder (); EditText trxdate = FindViewById<EditText> (Resource.Id.newinv_date); if (!Utility.IsValidDateString (trxdate.Text)) { Toast.MakeText (this,Resources.GetString(Resource.String.msg_invaliddate), ToastLength.Long).Show (); return; } DateTime dodate = Utility.ConvertToDate (trxdate.Text); DateTime tmr = dodate.AddDays (1); AdNumDate adNum= DataHelper.GetNumDate(pathToDatabase, dodate,"DO"); Spinner spinner = FindViewById<Spinner> (Resource.Id.newinv_custcode); Spinner spinner2 = FindViewById<Spinner> (Resource.Id.newinv_type); TextView txtinvno =FindViewById<TextView> (Resource.Id.newinv_no); EditText remark = FindViewById<EditText> (Resource.Id.newinv_custname); //EditText custpo = FindViewById<EditText> (Resource.Id.newinv_po); //EditText remark = FindViewById<EditText> (Resource.Id.newinv_remark); string prefix = apara.DOPrefix.Trim ().ToUpper (); if (spinner.SelectedItem == null) { Toast.MakeText (this, Resources.GetString(Resource.String.msg_invalidcust), ToastLength.Long).Show (); spinner.RequestFocus (); return; } string[] codes = spinner.SelectedItem.ToString().Split (new char[]{ '|' }); if (codes.Length == 0) return; using (var db = new SQLite.SQLiteConnection (pathToDatabase)) { string dono = ""; int runno = adNum.RunNo + 1; int currentRunNo =DataHelper.GetLastDORunNo(pathToDatabase, dodate); if (currentRunNo >= runno) runno = currentRunNo + 1; dono =prefix + dodate.ToString("yyMM") + runno.ToString().PadLeft (4, '0'); txtinvno.Text= dono; dorder.dodate = dodate; dorder.trxtype ="DO" ; dorder.created = DateTime.Now; dorder.dono = dono; dorder.description = codes [1].Trim (); dorder.remark = remark.Text; dorder.term = spinner2.SelectedItem.ToString (); dorder.amount = 0; dorder.custcode = codes [0].Trim (); dorder.isUploaded = false; txtinvno.Text = dono; db.Insert (dorder); adNum.RunNo = runno; if (adNum.ID >= 0) db.Update (adNum); else db.Insert (adNum); } ShowItemEntry (dorder, codes); }
void ShowItemEntry(DelOrder so, string[] codes) { //var intent = new Intent (this, typeof(DOEntryActivity)); var intent =ActivityManager.GetActivity<DOEntryActivity>(this.ApplicationContext); intent.PutExtra ("invoiceno", so.dono); intent.PutExtra ("customer", codes [1].Trim ()); intent.PutExtra ("itemuid", "-1"); intent.PutExtra ("editmode", "NEW"); StartActivity (intent); }
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(); }
void ShowItemEntry(DelOrder so, string[] codes) { var intent = new Intent (this, typeof(DOEntryActivity)); intent.PutExtra ("invoiceno", so.dono); intent.PutExtra ("customer", codes [1].Trim ()); intent.PutExtra ("itemuid", "-1"); intent.PutExtra ("editmode", "NEW"); StartActivity (intent); }
public string OpenBTAndPrintDO(BluetoothSocket mmSocket,BluetoothDevice mmDevice,DelOrder doOrder,DelOrderDtls[] list,int noofcopy ) { string msg = ""; string text = ""; PrintDO ( doOrder, list, ref text); BluetoothPrint (mmSocket, mmDevice, text, noofcopy); return msg; }
void PrintInv(DelOrder doorder,int noofcopy) { //Toast.MakeText (this, "print....", ToastLength.Long).Show (); DelOrderDtls[] list; using (var db = new SQLite.SQLiteConnection (pathToDatabase)){ var ls= db.Table<DelOrderDtls> ().Where (x => x.dono==doorder.dono).ToList<DelOrderDtls>(); list = new DelOrderDtls[ls.Count]; ls.CopyTo (list); } IPrintDocument prtSO = PrintDocManager.GetPrintDocument<PrintDelOrder>(); prtSO.SetDocument (doorder); prtSO.SetDocumentDtls(list); prtSO.SetNoOfCopy (noofcopy); prtSO.SetCallingActivity (this); if (prtSO.StartPrint ()) { updatePrintedStatus (doorder); var found = listData.Where (x => x.dono == doorder.dono).ToList (); if (found.Count > 0) { found [0].isPrinted = true; SetViewDlg viewdlg = SetViewDelegate; listView.Adapter = new GenericListAdapter<DelOrder> (this, listData, Resource.Layout.ListItemRow, viewdlg); } } else { Toast.MakeText (this, prtSO.GetErrMsg(), ToastLength.Long).Show (); } }
void StartPrint(DelOrder so,DelOrderDtls[] list,int noofcopy ) { string userid = ((GlobalvarsApp)this.Application).USERID_CODE; PrintInvHelper prnHelp = new PrintInvHelper (pathToDatabase, userid,compCode,branchCode); //string msg =prnHelp.OpenBTAndPrintSO (mmSocket, mmDevice,so, list,noofcopy); //Toast.MakeText (this, msg, ToastLength.Long).Show (); }
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 (); }
void Edit(DelOrder doorder) { var intent = new Intent (this, typeof(EditDelOrder)); intent.PutExtra ("dono", doorder.dono); StartActivity (intent); }
private void CreateNewDO() { DelOrder dorder = new DelOrder(); EditText trxdate = FindViewById <EditText> (Resource.Id.newinv_date); if (!Utility.IsValidDateString(trxdate.Text)) { Toast.MakeText(this, Resources.GetString(Resource.String.msg_invaliddate), ToastLength.Long).Show(); return; } DateTime dodate = Utility.ConvertToDate(trxdate.Text); DateTime tmr = dodate.AddDays(1); AdNumDate adNum = DataHelper.GetNumDate(pathToDatabase, dodate, "DO"); Spinner spinner = FindViewById <Spinner> (Resource.Id.newinv_custcode); Spinner spinner2 = FindViewById <Spinner> (Resource.Id.newinv_type); TextView txtinvno = FindViewById <TextView> (Resource.Id.newinv_no); EditText remark = FindViewById <EditText> (Resource.Id.newinv_custname); //EditText custpo = FindViewById<EditText> (Resource.Id.newinv_po); //EditText remark = FindViewById<EditText> (Resource.Id.newinv_remark); string prefix = apara.DOPrefix.Trim().ToUpper(); if (spinner.SelectedItem == null) { Toast.MakeText(this, Resources.GetString(Resource.String.msg_invalidcust), ToastLength.Long).Show(); spinner.RequestFocus(); return; } string[] codes = spinner.SelectedItem.ToString().Split(new char[] { '|' }); if (codes.Length == 0) { return; } using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { string dono = ""; int runno = adNum.RunNo + 1; int currentRunNo = DataHelper.GetLastDORunNo(pathToDatabase, dodate); if (currentRunNo >= runno) { runno = currentRunNo + 1; } dono = prefix + dodate.ToString("yyMM") + runno.ToString().PadLeft(4, '0'); txtinvno.Text = dono; dorder.dodate = dodate; dorder.trxtype = "DO"; dorder.created = DateTime.Now; dorder.dono = dono; dorder.description = codes [1].Trim(); dorder.remark = remark.Text; dorder.term = spinner2.SelectedItem.ToString(); dorder.amount = 0; dorder.custcode = codes [0].Trim(); dorder.isUploaded = false; txtinvno.Text = dono; db.Insert(dorder); adNum.RunNo = runno; if (adNum.ID >= 0) { db.Update(adNum); } else { db.Insert(adNum); } } ShowItemEntry(dorder, codes); }
void Delete(DelOrder inv) { var builder = new AlertDialog.Builder(this); builder.SetMessage("Confimr to Delete?"); builder.SetPositiveButton("YES", (s, e) => { DeleteItem(inv); }); builder.SetNegativeButton("Cancel", (s, e) => { /* do something on Cancel click */ }); builder.Create().Show(); }
public void SetDocument(object doc) { delOrder = (DelOrder)doc; }
void PrintDO(DelOrder doorder, DelOrderDtls[] list, ref string test) { PrintCompHeader (ref test); PrintCustomer (ref test, doorder.custcode); PrintDOHeader (ref test, doorder); string dline = ""; double ttlAmt = 0; double ttltax = 0; int count = 0; foreach (DelOrderDtls itm in list) { count += 1; dline = dline + PrintDODetail (itm, count); ttlAmt = ttlAmt + itm.qty; } test += dline; PrintDOTotal (ref test, ttlAmt); PrintFooter (ref test); //test += "\nTHANK YOU\n\n\n\n"; }
void PrintDOHeader(ref string test,DelOrder doOrder) { string userid = USERID; string title1 = "DELIVERY ORDER"; string date = DateTime.Now.ToString ("dd-MM-yyyy"); string datetime = DateTime.Now.ToString ("dd-MM-yyyy hh:mm tt"); if (compinfo.ShowTime) { test += datetime+title1.PadLeft(41-datetime.Length,' ')+"\n"; } else { test += date+title1.PadLeft(41-date.Length,' ')+"\n"; } string recno = "DELIVERY ORDER NO : " + doOrder.dono.Trim(); test += recno+"\n"; string issueline = "ISSUED BY: " + userid.ToUpper (); issueline = issueline +"\n"; test += issueline;// "ISSUED BY: " + userid.ToUpper()+"\n"; if (doOrder.remark.Length > 1) { test += "REMARK:\n"; test += doOrder.remark+"\n"; } test += "------------------------------------------\n"; test += "NO DESCRIPTION QTY\n"; test += "------------------------------------------\n"; // 1234 // 12345678901234567890123456789012312345 // }
void DeleteItem(DelOrder doorder) { using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { var list = db.Table<DelOrder>().Where(x=>x.dono==doorder.dono&&x.CompCode==compCode&&x.BranchCode==branchCode).ToList<DelOrder>(); if (list.Count > 0) { db.Delete (list [0]); var arrlist= listData.Where(x=>x.dono==doorder.dono).ToList<DelOrder>(); if (arrlist.Count > 0) { listData.Remove (arrlist [0]); SetViewDlg viewdlg = SetViewDelegate; listView.Adapter = new GenericListAdapter<DelOrder> (this, listData, Resource.Layout.ListItemRow, viewdlg); } } } }
void Delete(DelOrder inv) { var builder = new AlertDialog.Builder(this); builder.SetMessage(Resources.GetString(Resource.String.msg_confirmdelete)+"?"); builder.SetPositiveButton("YES", (s, e) => { DeleteItem(inv); }); builder.SetNegativeButton("Cancel", (s, e) => { /* do something on Cancel click */ }); builder.Create().Show(); }
void updatePrintedStatus(DelOrder so) { using (var db = new SQLite.SQLiteConnection (pathToDatabase)) { var list = db.Table<DelOrder> ().Where (x => x.dono == so.dono&&x.CompCode==compCode&&x.BranchCode==branchCode).ToList<DelOrder> (); if (list.Count > 0) { var list2 = db.Table<DelOrderDtls> () .Where (x => x.dono == so.dono&&x.CompCode==compCode&&x.BranchCode==branchCode) .ToList<DelOrderDtls> (); if (list2.Count > 0) { list [0].isPrinted = true; db.Update (list [0]); } } } }
internal string GetDelOrderText_Template(string templatefilename,string pathToDatabase, string userID, DelOrder delOrder, DelOrderDtls[] list) { //yet to implement return ""; }
void PrintInv(DelOrder so,int noofcopy) { Toast.MakeText (this, "print....", ToastLength.Long).Show (); DelOrderDtls[] list; using (var db = new SQLite.SQLiteConnection (pathToDatabase)){ var ls= db.Table<DelOrderDtls> () .Where (x => x.dono==so.dono&&x.CompCode==compCode&&x.BranchCode==branchCode).ToList<DelOrderDtls>(); list = new DelOrderDtls[ls.Count]; ls.CopyTo (list); } mmDevice = null; findBTPrinter (); if (mmDevice != null) { StartPrint (so, list,noofcopy); if (!so.isPrinted) { updatePrintedStatus (so); var found =listData.Where (x => x.dono==so.dono&&x.CompCode==compCode&&x.BranchCode==branchCode).ToList (); if (found.Count > 0) { found [0].isPrinted = true; SetViewDlg viewdlg = SetViewDelegate; listView.Adapter = new GenericListAdapter<DelOrder> (this, listData, Resource.Layout.ListItemRow, viewdlg); } } } }
internal string GetDelOrderText_Template(string templatefilename, string pathToDatabase, string userID, DelOrder delOrder, DelOrderDtls[] list) { //yet to implement return(""); }
void updatePrintedStatus(DelOrder so) { using (var db = new SQLite.SQLiteConnection (pathToDatabase)) { var list = db.Table<DelOrder> ().Where (x => x.dono == so.dono&&x.CompCode==compCode&&x.BranchCode==branchCode).ToList<DelOrder> (); if (list.Count > 0) { //if only contains items then allow to update the printed status. //this to allow the invoice;s item can be added. if not can not be posted(upload) var list2 = db.Table<DelOrderDtls> () .Where (x => x.dono == so.dono&&x.CompCode==compCode&&x.BranchCode==branchCode) .ToList<DelOrderDtls> (); if (list2.Count > 0) { list [0].isPrinted = true; db.Update (list [0]); } } } }
private bool SaveDO() { bool lSave = false; DelOrder dorder = new DelOrder (); EditText trxdate = FindViewById<EditText> (Resource.Id.newinv_date); if (!Utility.IsValidDateString (trxdate.Text)) { Toast.MakeText (this,Resources.GetString(Resource.String.msg_invaliddate), ToastLength.Long).Show (); return lSave; } DateTime dodate = Utility.ConvertToDate (trxdate.Text); Spinner spinner = FindViewById<Spinner> (Resource.Id.newinv_custcode); Spinner spinner2 = FindViewById<Spinner> (Resource.Id.newinv_type); TextView txtinvno =FindViewById<TextView> (Resource.Id.newinv_no); EditText remark = FindViewById<EditText> (Resource.Id.newinv_custname); if (spinner.SelectedItem == null) { Toast.MakeText (this, Resources.GetString(Resource.String.msg_invalidcust), ToastLength.Long).Show (); spinner.RequestFocus (); return lSave; } string[] codes = spinner.SelectedItem.ToString().Split (new char[]{ '|' }); if (codes.Length == 0) return lSave; using (var db = new SQLite.SQLiteConnection (pathToDatabase)) { doInfo.dodate = dodate; doInfo.description = codes [1].Trim (); doInfo.remark = remark.Text; doInfo.term = spinner2.SelectedItem.ToString (); doInfo.amount = 0; doInfo.custcode = codes [0].Trim (); db.Update (doInfo); lSave = true; } return lSave; }