public void PrintHeaderSO(ref string test, SaleOrder so) { string userid = USERID; string title1 = "SALES ORDER"; string date = so.sodate.ToString("dd-MM-yyyy"); //string datetime = so.sodate.ToString ("dd-MM-yyyy hh:mm tt"); string datetime = so.sodate.ToString("dd-MM-yyyy") + " " + so.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 = "SALES ORDER NO : " + so.sono.Trim(); test += recno + "\n"; test += "CUST PO NO : " + so.custpono + "\n"; string issueline = "ISSUED BY: " + userid.ToUpper(); issueline = issueline + "\n"; test += issueline; // "ISSUED BY: " + userid.ToUpper()+"\n"; if (!string.IsNullOrEmpty(so.remark)) { string reason = "REMARK: " + so.remark; PrintLongText(ref test, reason); } }
private void GetSaleOrderText(SaleOrder so, SaleOrderDtls[] list) { if (string.IsNullOrEmpty(so.billTo)) { prtcompHeader.PrintCompHeader(ref text); } else { prtcompHeader.PrintCustomerHeader(ref text, so.billTo); } prtCustHeader.PrintCustomer(ref text, so.custcode); prtHeader.PrintSOHeader_NTax(ref text, so); string dline = ""; double ttlAmt = 0; double ttltax = 0; int count = 0; foreach (SaleOrderDtls itm in list) { count += 1; dline = dline + prtDetail.PrintSODetail_NTax(itm, count); ttlAmt = ttlAmt + itm.netamount; ttltax = ttltax + itm.tax; } text += dline; prtTotal.PrintTotal_NTax(ref text, ttlAmt, ttltax); //prtTaxSummary.PrintSOTaxSumm (ref text, list); prtFooter.PrintFooter(ref text); text += "\nTHANK YOU\n\n\n\n\n\n\n\n"; }
private void SetViewDelegate(View view, object clsobj) { SaleOrder item = (SaleOrder)clsobj; view.FindViewById <TextView> (Resource.Id.invdate).Text = item.sodate.ToString("dd-MM-yy"); view.FindViewById <TextView> (Resource.Id.invno).Text = item.sono; view.FindViewById <TextView> (Resource.Id.trxtype).Text = item.custpono; 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 = item.taxamt.ToString("n2"); double ttl = item.amount + item.taxamt; view.FindViewById <TextView> (Resource.Id.TtlAmount).Text = ttl.ToString("n2"); 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(); } }
void PrintSO(SaleOrder so, int noofcopy) { //Toast.MakeText (this, "print....", ToastLength.Long).Show (); SaleOrderDtls[] list; using (var db = new SQLite.SQLiteConnection(pathToDatabase)){ var ls = db.Table <SaleOrderDtls> ().Where(x => x.sono == so.sono).ToList <SaleOrderDtls>(); list = new SaleOrderDtls[ls.Count]; ls.CopyTo(list); } IPrintDocument prtSO = PrintDocManager.GetPrintDocument <PrintSalesOrder>(); prtSO.SetDocument(so); prtSO.SetDocumentDtls(list); prtSO.SetNoOfCopy(noofcopy); prtSO.SetCallingActivity(this); if (prtSO.StartPrint()) { updatePrintedStatus(so); var found = listData.Where(x => x.sono == so.sono).ToList(); if (found.Count > 0) { found [0].isPrinted = true; SetViewDlg viewdlg = SetViewDelegate; listView.Adapter = new GenericListAdapter <SaleOrder> (this, listData, Resource.Layout.ListItemRow, viewdlg); } } else { Toast.MakeText(this, prtSO.GetErrMsg(), ToastLength.Long).Show(); } }
public void PrintPaymentHeader(ref string test, SaleOrder so) { string userid = USERID; string title1 = "PAYMENT VOUCHER"; string date = so.sodate.ToString("dd-MM-yyyy"); //string datetime = so.sodate.ToString ("dd-MM-yyyy hh:mm tt"); string datetime = so.sodate.ToString("dd-MM-yyyy") + " " + so.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 = "REFERENCE NO : " + so.sono.Trim(); test += recno + "\n"; test += "CUST PO NO : " + so.custpono + "\n"; string issueline = "ISSUED BY: " + userid.ToUpper(); issueline = issueline + "\n"; test += issueline; // "ISSUED BY: " + userid.ToUpper()+"\n"; if (so.remark.Length > 1) { test += "REMARK:\n"; test += so.remark + "\n"; } printCaption(ref test); }
void Edit(SaleOrder so) { //var intent = new Intent (this, typeof(EditInvoice)); var intent = ActivityManager.GetActivity <EditSaleOrder>(this.ApplicationContext); intent.PutExtra("sono", so.sono); StartActivity(intent); }
void Delete(SaleOrder 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 OnListItemClick(object sender, AdapterView.ItemClickEventArgs e) { SaleOrder item = listData.ElementAt(e.Position); var intent = new Intent(this, typeof(SOItemHisActivity)); intent.PutExtra("invoiceno", item.sono); intent.PutExtra("custcode", item.custcode); StartActivity(intent); }
void OnListItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e) { SaleOrder item = listData.ElementAt(e.Position); PopupMenu menu = new PopupMenu(e.Parent.Context, e.View); menu.Inflate(Resource.Menu.popupInv); menu.Menu.RemoveItem(Resource.Id.poppay); menu.Menu.RemoveItem(Resource.Id.popInvdelete); if (!rights.SOAllowAdd) { menu.Menu.RemoveItem(Resource.Id.popInvadd); } if (!rights.SOAllowEdit) { menu.Menu.RemoveItem(Resource.Id.popInvedit); } if (!rights.SOAllowPrint) { menu.Menu.RemoveItem(Resource.Id.popInvprint); menu.Menu.RemoveItem(Resource.Id.popInvprint2); } if (DataHelper.GetSaleOrderPrintStatus(pathToDatabase, item.sono, rights)) { menu.Menu.RemoveItem(Resource.Id.popInvdelete); menu.Menu.RemoveItem(Resource.Id.popInvedit); } menu.MenuItemClick += (s1, arg1) => { if (arg1.Item.ItemId == Resource.Id.popInvadd) { CreateNewSaleOrder(); } else if (arg1.Item.ItemId == Resource.Id.popInvprint) { PrintInv(item, 1); } else if (arg1.Item.ItemId == Resource.Id.popInvprint2) { PrintInv(item, 2); } else if (arg1.Item.ItemId == Resource.Id.popInvdelete) { Delete(item); } else if (arg1.Item.ItemId == Resource.Id.popInvedit) { Edit(item); } }; menu.Show(); }
void ShowItemEntry(SaleOrder so, string[] codes) { //var intent = new Intent (this, typeof(SOEntryActivity)); var intent = ActivityManager.GetActivity <SOEntryActivityEx>(this.ApplicationContext); intent.PutExtra("invoiceno", so.sono); intent.PutExtra("customer", codes [1].Trim()); intent.PutExtra("custcode", codes [0].Trim()); intent.PutExtra("itemuid", "-1"); intent.PutExtra("editmode", "NEW"); StartActivity(intent); }
public static SaleOrder GetSO(string pathToDatabase, string sono) { SaleOrder inv = null; using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { var list2 = db.Table <SaleOrder> ().ToList <SaleOrder>().Where(x => x.sono == sono).ToList(); if (list2.Count > 0) { inv = list2 [0]; } } return(inv); }
void LoadCashBill() { using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { var list = db.Table <SaleOrder> ().Where(x => x.sono == INVOICENO).ToList(); if (list.Count > 0) { inv = list [0]; txtcnno.Text = inv.sono; txtInvDate.Text = inv.sodate.ToString("dd-MM-yyyy"); txtInvMode.Text = "NEW"; } } EnableControLs(true, true, false, true, false); }
void updatePrintedStatus(SaleOrder so) { using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { var list = db.Table <SaleOrder> ().Where(x => x.sono == so.sono).ToList <SaleOrder> (); 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 <SaleOrderDtls> ().Where(x => x.sono == so.sono).ToList <SaleOrderDtls> (); if (list2.Count > 0) { list [0].isPrinted = true; db.Update(list [0]); } } } }
void DeleteItem(SaleOrder inv) { using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { var list = db.Table <SaleOrder>().Where(x => x.sono == inv.sono).ToList <SaleOrder>(); if (list.Count > 0) { db.Delete(list [0]); var arrlist = listData.Where(x => x.sono == inv.sono).ToList <SaleOrder>(); if (arrlist.Count > 0) { listData.Remove(arrlist [0]); SetViewDlg viewdlg = SetViewDelegate; listView.Adapter = new GenericListAdapter <SaleOrder> (this, listData, Resource.Layout.ListItemRow, viewdlg); } } } }
void OnListItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e) { SaleOrder item = listData.ElementAt(e.Position); PopupMenu menu = new PopupMenu(e.Parent.Context, e.View); menu.Inflate(Resource.Menu.popupHis); if (!rights.InvAllowPrint) { menu.Menu.RemoveItem(Resource.Id.popInvprint); menu.Menu.RemoveItem(Resource.Id.popInvprint2); } menu.MenuItemClick += (s1, arg1) => { if (arg1.Item.ItemId == Resource.Id.popInvprint) { PrintSO(item, 1); } else if (arg1.Item.ItemId == Resource.Id.popInvprint2) { PrintSO(item, 2); } }; menu.Show(); }
private void GetSaleOrderText(SaleOrder so, SaleOrderDtls[] list) { //if (string.IsNullOrEmpty(so.billTo)) prtcompHeader.PrintCompHeader (ref text); //else prtcompHeader.PrintCustomerHeader(ref text,so.billTo); prtCustHeader.PrintCustomer (ref text, so.custcode); prtHeader.PrintSOHeader (ref text, so); string dline = ""; double ttlAmt = 0; double ttltax = 0; int count = 0; foreach (SaleOrderDtls itm in list) { count += 1; dline = dline + prtDetail.PrintSODetail (itm, count); ttlAmt = ttlAmt + itm.netamount; ttltax = ttltax + itm.tax; } text += dline; prtTotal.PrintTotal (ref text, ttlAmt, ttltax); prtTaxSummary.PrintSOTaxSumm (ref text, list); prtFooter.PrintFooter (ref text); text += "\nTHANK YOU\n\n\n\n\n\n\n\n"; }
public void PrintHeaderSO(ref string test,SaleOrder so) { string userid = USERID; string title1 = "SALES ORDER"; string date = so.sodate.ToString ("dd-MM-yyyy"); //string datetime = so.sodate.ToString ("dd-MM-yyyy hh:mm tt"); string datetime = so.sodate.ToString ("dd-MM-yyyy")+" "+so.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 = "SALES ORDER NO : " + so.sono.Trim(); test += recno+"\n"; test += "CUST PO NO : " + so.custpono+"\n"; string issueline = "ISSUED BY: " + userid.ToUpper (); issueline = issueline +"\n"; test += issueline;// "ISSUED BY: " + userid.ToUpper()+"\n"; if (!string.IsNullOrEmpty (so.remark)) { string reason = "REMARK: " + so.remark; PrintLongText (ref test, reason); } }
public void PrintSOHeader_NTax(ref string test,SaleOrder so) { PrintHeaderSO (ref test, so); printCaption_NTax (ref test); }
void PrintSOHeader(ref string test,SaleOrder so) { string userid = USERID; string title1 = "SALES 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 = "SALES ORDER NO : " + so.sono.Trim(); test += recno+"\n"; test += "CUST PO NO : " + so.custpono+"\n"; string issueline = "ISSUED BY: " + userid.ToUpper (); issueline = issueline +"\n"; test += issueline;// "ISSUED BY: " + userid.ToUpper()+"\n"; if (so.remark.Length > 1) { test += "REMARK:\n"; test += so.remark+"\n"; } test += "------------------------------------------\n"; test += "DESCRIPTION \n"; test += "NO QTY U/PRICE TAX AMT AMOUNT\n"; test += "------------------------------------------\n"; }
void updatePrintedStatus(SaleOrder so) { using (var db = new SQLite.SQLiteConnection (pathToDatabase)) { var list = db.Table<SaleOrder> ().Where (x => x.sono == so.sono).ToList<SaleOrder> (); 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<SaleOrderDtls> ().Where (x => x.sono == so.sono).ToList<SaleOrderDtls> (); if (list2.Count > 0) { list [0].isPrinted = true; db.Update (list [0]); } } } }
void Edit(SaleOrder so) { //var intent = new Intent (this, typeof(EditInvoice)); var intent =ActivityManager.GetActivity<EditSaleOrder>(this.ApplicationContext); intent.PutExtra ("sono", so.sono); StartActivity (intent); }
void LoadCashBill() { using (var db = new SQLite.SQLiteConnection (pathToDatabase)) { var list= db.Table<SaleOrder> ().Where (x => x.sono== INVOICENO).ToList (); if (list.Count > 0) { inv = list [0]; txtcnno.Text = inv.sono; txtInvDate.Text = inv.sodate.ToString ("dd-MM-yyyy"); txtInvMode.Text = "NEW"; } } EnableControLs (true, true, false, true, false); }
public void PrintSOHeader_NTax(ref string test, SaleOrder so) { PrintHeaderSO(ref test, so); printCaption_NTax(ref test); }
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(); }
public void SetDocument(object doc) { so = (SaleOrder)doc; }
private void CreateNewSO() { SaleOrder so = new SaleOrder(); 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 sodate = Utility.ConvertToDate(trxdate.Text); DateTime tmr = sodate.AddDays(1); AdNumDate adNum = DataHelper.GetNumDate(pathToDatabase, sodate, "SO"); Spinner spinner = FindViewById <Spinner> (Resource.Id.newinv_custcode); TextView txtinvno = FindViewById <TextView> (Resource.Id.newinv_no); TextView custname = FindViewById <TextView> (Resource.Id.newinv_custname); EditText custpo = FindViewById <EditText> (Resource.Id.newinv_po); EditText remark = FindViewById <EditText> (Resource.Id.newinv_remark); string prefix = apara.SOPrefix.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; } string[] codes2 = spinnerBill.SelectedItem.ToString().Split(new char[] { '|' }); string billTo = ""; if (codes.Length > 0) { billTo = codes2 [0].Trim(); } using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { string sono = ""; int runno = adNum.RunNo + 1; int currentRunNo = DataHelper.GetLastSORunNo(pathToDatabase, sodate); if (currentRunNo >= runno) { runno = currentRunNo + 1; } sono = prefix + sodate.ToString("yyMM") + runno.ToString().PadLeft(4, '0'); txtinvno.Text = sono; so.sodate = sodate; so.trxtype = "SO"; so.created = DateTime.Now; so.sono = sono; so.billTo = billTo; so.remark = remark.Text.ToUpper(); so.custpono = custpo.Text.ToUpper(); so.amount = 0; so.custcode = codes [0].Trim(); so.description = codes [1].Trim(); so.isUploaded = false; txtinvno.Text = sono; db.Insert(so); adNum.RunNo = runno; if (adNum.ID >= 0) { db.Update(adNum); } else { db.Insert(adNum); } } ShowItemEntry(so, codes); }
void updatePrintedStatus(SaleOrder inv) { using (var db = new SQLite.SQLiteConnection (pathToDatabase)) { var list = db.Table<SaleOrder> ().Where (x => x.sono == inv.sono&&x.CompCode==compCode&&x.BranchCode==branchCode).ToList<SaleOrder> (); if (list.Count > 0) { list [0].isPrinted = true; db.Update (list [0]); } } }
void PrintInv(SaleOrder inv,int noofcopy) { //Toast.MakeText (this, "print....", ToastLength.Long).Show (); SaleOrderDtls[] list; using (var db = new SQLite.SQLiteConnection (pathToDatabase)){ var ls= db.Table<SaleOrderDtls> ().Where (x => x.sono==inv.sono&&x.CompCode==compCode&&x.BranchCode==branchCode).ToList<SaleOrderDtls>(); list = new SaleOrderDtls[ls.Count]; ls.CopyTo (list); } mmDevice = null; findBTPrinter (); if (mmDevice != null) { StartPrint (inv, list,noofcopy); updatePrintedStatus (inv); } }
void ShowItemEntry(SaleOrder so, string[] codes) { var intent = new Intent (this, typeof(SOEntryActivity)); intent.PutExtra ("invoiceno", so.sono); intent.PutExtra ("customer", codes [1].Trim ()); intent.PutExtra ("itemuid", "-1"); intent.PutExtra ("editmode", "NEW"); StartActivity (intent); }
internal string GetSaleOrderText_Template(string templatefilename,string pathToDatabase,string userID, SaleOrder so, SaleOrderDtls[] list) { //yet to implement return ""; }
public string OpenBTAndPrintSO(BluetoothSocket mmSocket,BluetoothDevice mmDevice,SaleOrder so,SaleOrderDtls[] list,int noofcopy ) { string msg = ""; string text = ""; PrintSO (so, list, ref text); BluetoothPrint (mmSocket, mmDevice, text, noofcopy); return msg; }
void Delete(SaleOrder 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(); }
void ShowItemEntry(SaleOrder so, string[] codes) { //var intent = new Intent (this, typeof(SOEntryActivity)); var intent =ActivityManager.GetActivity<SOEntryActivityEx>(this.ApplicationContext); intent.PutExtra ("invoiceno", so.sono); intent.PutExtra ("customer", codes [1].Trim ()); intent.PutExtra ("custcode",codes [0].Trim ()); intent.PutExtra ("itemuid", "-1"); intent.PutExtra ("editmode", "NEW"); StartActivity (intent); }
void StartPrint(SaleOrder so,SaleOrderDtls[] 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 (); //AlertShow (msg); }
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); TextView lbBillto = FindViewById<TextView> (Resource.Id.lbbillto); lbBillto.Text = "PAY FROM"; 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); }; 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 (); }
private void CreateNewSO() { SaleOrder so = new SaleOrder (); EditText trxdate = FindViewById<EditText> (Resource.Id.newinv_date); if (!Utility.IsValidDateString (trxdate.Text)) { Toast.MakeText (this,"Invalid Transaction Date format...", ToastLength.Long).Show (); return; } DateTime sodate = Utility.ConvertToDate (trxdate.Text); DateTime tmr = sodate.AddDays (1); AdNumDate adNum= DataHelper.GetNumDate(pathToDatabase, sodate,"SO",compCode,branchCode); Spinner spinner = FindViewById<Spinner> (Resource.Id.newinv_custcode); TextView txtinvno =FindViewById<TextView> (Resource.Id.newinv_no); TextView custname = FindViewById<TextView> (Resource.Id.newinv_custname); EditText custpo = FindViewById<EditText> (Resource.Id.newinv_po); EditText remark = FindViewById<EditText> (Resource.Id.newinv_remark); string prefix = apara.SOPrefix.Trim ().ToUpper (); if (spinner.SelectedItem == null) { Toast.MakeText (this, "No Customer code selected...", 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 sono = ""; int runno = adNum.RunNo + 1; int currentRunNo =DataHelper.GetLastSORunNo(pathToDatabase, sodate,compCode,branchCode); if (currentRunNo >= runno) runno = currentRunNo + 1; sono =prefix + sodate.ToString("yyMM") + runno.ToString().PadLeft (4, '0'); txtinvno.Text= sono; so.sodate = sodate; so.trxtype ="SO" ; so.created = DateTime.Now; so.sono = sono; so.description = custname.Text; so.remark = remark.Text; so.custpono = custpo.Text; so.amount = 0; so.custcode = codes [0].Trim (); so.isUploaded = false; so.CompCode = compCode; so.BranchCode = branchCode; txtinvno.Text = sono; db.Insert (so); adNum.RunNo = runno; if (adNum.ID >= 0) db.Update (adNum); else db.Insert (adNum); } ShowItemEntry (so, codes); }
internal string GetSaleOrderText_Template(string templatefilename, string pathToDatabase, string userID, SaleOrder so, SaleOrderDtls[] list) { //yet to implement return(""); }
void DeleteItem(SaleOrder inv) { using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { var list = db.Table<SaleOrder>().Where(x=>x.sono==inv.sono).ToList<SaleOrder>(); if (list.Count > 0) { db.Delete (list [0]); var arrlist= listData.Where(x=>x.sono==inv.sono).ToList<SaleOrder>(); if (arrlist.Count > 0) { listData.Remove (arrlist [0]); SetViewDlg viewdlg = SetViewDelegate; listView.Adapter = new GenericListAdapter<SaleOrder> (this, listData, Resource.Layout.ListItemRow, viewdlg); } } } }
public void SetDocument(object doc) { so = (SaleOrder)doc; }
void PrintInv(SaleOrder so,int noofcopy) { //Toast.MakeText (this, "print....", ToastLength.Long).Show (); SaleOrderDtls[] list; using (var db = new SQLite.SQLiteConnection (pathToDatabase)){ var ls= db.Table<SaleOrderDtls> ().Where (x => x.sono==so.sono).ToList<SaleOrderDtls>(); list = new SaleOrderDtls[ls.Count]; ls.CopyTo (list); } IPrintDocument prtSO = PrintDocManager.GetPrintDocument<PrintSalesOrder>(); prtSO.SetDocument (so); prtSO.SetDocumentDtls(list); prtSO.SetNoOfCopy (noofcopy); prtSO.SetCallingActivity (this); if (prtSO.StartPrint ()) { updatePrintedStatus (so); var found = listData.Where (x => x.sono == so.sono).ToList (); if (found.Count > 0) { found [0].isPrinted = true; SetViewDlg viewdlg = SetViewDelegate; listView.Adapter = new GenericListAdapter<SaleOrder> (this, listData, Resource.Layout.ListItemRow, viewdlg); } } else { Toast.MakeText (this, prtSO.GetErrMsg(), ToastLength.Long).Show (); } }
public void PrintPaymentHeader(ref string test,SaleOrder so) { string userid = USERID; string title1 = "PAYMENT VOUCHER"; string date = so.sodate.ToString ("dd-MM-yyyy"); //string datetime = so.sodate.ToString ("dd-MM-yyyy hh:mm tt"); string datetime = so.sodate.ToString ("dd-MM-yyyy")+" "+so.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 = "REFERENCE NO : " + so.sono.Trim(); test += recno+"\n"; test += "CUST PO NO : " + so.custpono+"\n"; string issueline = "ISSUED BY: " + userid.ToUpper (); issueline = issueline +"\n"; test += issueline;// "ISSUED BY: " + userid.ToUpper()+"\n"; if (so.remark.Length > 1) { test += "REMARK:\n"; test += so.remark+"\n"; } printCaption (ref test); }
void Delete(SaleOrder 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 PrintSO(SaleOrder so, SaleOrderDtls[] list, ref string test) { PrintCompHeader (ref test); PrintCustomer (ref test, so.custcode); PrintSOHeader (ref test, so); string dline = ""; double ttlAmt = 0; double ttltax = 0; int count = 0; foreach (SaleOrderDtls itm in list) { count += 1; dline = dline + PrintSODetail (itm, count); ttlAmt = ttlAmt + itm.netamount; ttltax = ttltax + itm.tax; } test += dline; PrintTotal (ref test, ttlAmt, ttltax); PrintSOTaxSumm (ref test, list); PrintFooter (ref test); test += "\nTHANK YOU\n\n\n\n"; }