java - Modification in WAGU (data in table view) library -
referring post, in answer given mr. clough, has written code output this,
platinum computers(pvt) ltd no 20/b, main street, kandy, sri lanka. land: 812254630 mob: 712205220 fax: 812254639 customer invoice +-----------------------+----------------------+ |info |customer | +-----------------------+----------------------+ |date: 2015-9-8 |moderntec distributors| |time: 10:53:am |mob: +94719530398 | |bill no: 12 |addres: no 25, main st| |invoice no: 458-80-108 |reet, kandy. | +-----------------------+----------------------+ | selling details | +-----------------+---------+-----+------------+ |item | price($)| qty| value| +-----------------+---------+-----+------------+ |optical mouse | 120.00| 20| 2400.00| |gaming keyboard | 550.00| 30| 16500.00| |320gb sata hdd | 220.00| 32| 7040.00| |500gb sata hdd | 274.00| 13| 3562.00| |1tb sata hdd | 437.00| 11| 4807.00| |re-dvd rom | 144.00| 29| 4176.00| |ddr3 4gb ram | 143.00| 13| 1859.00| |blu-ray dvd | 94.00| 28| 2632.00| |wr-dvd | 122.00| 34| 4148.00| |adapter | 543.00| 28| 15204.00| +-----------------+---------+-----+------------+ | returning details | +-----------------+---------+-----+------------+ |item | price($)| qty| value| +-----------------+---------+-----+------------+ |320gb sata hdd | 220.00| 4| 880.00| |wr-dvd | 122.00| 7| 854.00| |1tb sata hdd | 437.00| 7| 3059.00| |re-dvd rom | 144.00| 4| 576.00| |gaming keyboard | 550.00| 6| 3300.00| |ddr3 4gb ram | 143.00| 7| 1001.00| +-----------------+---------+-----+------------+ gross 59,928.00 discount(5%) 2,996.40 return 9,670.00 payable 47,261.60 cash 20,000.00 cheque 15,000.00 credit(balance) 12,261.60 --------------------- --------------------- cash collector goods received soulution clough.com
the code above output below:
string company = "" + "platinum computers(pvt) ltd\n" + "no 20/b, main street, kandy, sri lanka.\n" + "land: 812254630 mob: 712205220 fax: 812254639\n" + " \n" + "customer invoice\n" + " \n"; list<string> t1headers = arrays.aslist("info", "customer"); list<list<string>> t1rows = arrays.aslist( arrays.aslist("date: 2015-9-8", "moderntec distributors"), arrays.aslist("time: 10:53:am", "mob: +94719530398"), arrays.aslist("bill no: 12", "addres: no 25, main street, kandy."), arrays.aslist("invoice no: 458-80-108", "") ); string t2desc = "selling details"; list<string> t2headers = arrays.aslist("item", "price($)", "qty", "value"); list<list<string>> t2rows = arrays.aslist( arrays.aslist("optical mouse", "120.00", "20", "2400.00"), arrays.aslist("gaming keyboard", "550.00", "30", "16500.00"), arrays.aslist("320gb sata hdd", "220.00", "32", "7040.00"), arrays.aslist("500gb sata hdd", "274.00", "13", "3562.00"), arrays.aslist("1tb sata hdd", "437.00", "11", "4807.00"), arrays.aslist("re-dvd rom", "144.00", "29", "4176.00"), arrays.aslist("ddr3 4gb ram", "143.00", "13", "1859.00"), arrays.aslist("blu-ray dvd", "94.00", "28", "2632.00"), arrays.aslist("wr-dvd", "122.00", "34", "4148.00"), arrays.aslist("adapter", "543.00", "28", "15204.00") ); list<integer> t2colwidths = arrays.aslist(17, 9, 5, 12); string t3desc = "returning details"; list<string> t3headers = arrays.aslist("item", "price($)", "qty", "value"); list<list<string>> t3rows = arrays.aslist( arrays.aslist("320gb sata hdd", "220.00", "4", "880.00"), arrays.aslist("wr-dvd", "122.00", "7", "854.00"), arrays.aslist("1tb sata hdd", "437.00", "7", "3059.00"), arrays.aslist("re-dvd rom", "144.00", "4", "576.00"), arrays.aslist("gaming keyboard", "550.00", "6", "3300.00"), arrays.aslist("ddr3 4gb ram", "143.00", "7", "1001.00") ); string summary = "" + "gross\n" + "discount(5%)\n" + "return\n" + "payable\n" + "cash\n" + "cheque\n" + "credit(balance)\n"; string summaryval = "" + "59,928.00\n" + "2,996.40\n" + "9,670.00\n" + "47,261.60\n" + "20,000.00\n" + "15,000.00\n" + "12,261.60\n"; string sign1 = "" + "---------------------\n" + "cash collector\n"; string sign2 = "" + "---------------------\n" + "goods received by\n"; string advertise = "soulution clough.com"; //bookmark board b = new board(48); b.setinitialblock(new block(b, 46, 7, company).allowgrid(false).setblockalign(block.block_centre).setdataalign(block.data_center)); b.appendtableto(0, board.append_below, new table(b, 48, t1headers, t1rows)); b.getblock(3).setbelowblock(new block(b, 46, 1, t2desc).setdataalign(block.data_center)); b.appendtableto(5, board.append_below, new table(b, 48, t2headers, t2rows, t2colwidths)); b.getblock(10).setbelowblock(new block(b, 46, 1, t3desc).setdataalign(block.data_center)); b.appendtableto(14, board.append_below, new table(b, 48, t3headers, t3rows, t2colwidths)); block summaryblock = new block(b, 35, 9, summary).allowgrid(false).setdataalign(block.data_middle_right); b.getblock(19).setbelowblock(summaryblock); block summaryvalblock = new block(b, 12, 9, summaryval).allowgrid(false).setdataalign(block.data_middle_right); summaryblock.setrightblock(summaryvalblock); block sign1block = new block(b, 24, 7, sign1).setdataalign(block.data_bottom_middle).allowgrid(false); summaryblock.setbelowblock(sign1block); sign1block.setrightblock(new block(b, 24, 7, sign2).setdataalign(block.data_bottom_middle).allowgrid(false)); sign1block.setbelowblock(new block(b, 48, 3, advertise).setdataalign(block.data_center).allowgrid(false)); //b.showblockindex(true); system.out.println(b.invalidate().build().getpreview());
now problem facing don't want returning details section invoice. want add company heading section info , customer section, selling details , total only.
i writing code have made changes according requirements unable cut section of return details , sign section. below code:
string company = "" + "v.k autos larkana\n" + "near rehmaniya masjid larkana\n" + "police shopping center larkana\n" + "cell: 0334-3269198, 0333-3910951\n" + " \n" + "customer invoice\n" + " \n"; calendar cal = calendar.getinstance(); simpledateformat sdf = new simpledateformat("hh:mm:ss"); list<string> t1headers = arrays.aslist("info", "customer"); list<list<string>> t1rows = arrays.aslist( arrays.aslist("date: " + date + "", "" + txt_cnam.gettext()), arrays.aslist("time: " + sdf.format(cal.gettime()) + "", "bill no:" + billno + "") ); string t2desc = "selling details"; list<string> t2headers = arrays.aslist("item", "qty", "rate", "total"); list<list<string>> t2rows = new arraylist<list<string>>(); (int = 0; < tbl_sale.getrowcount(); i++) { string pid = tbl_sale.getvalueat(i, 0).tostring(); string item = tbl_sale.getvalueat(i, 1).tostring(); string quant = tbl_sale.getvalueat(i, 2).tostring(); string rate = tbl_sale.getvalueat(i, 3).tostring(); string rs = tbl_sale.getvalueat(i, 4).tostring(); arraylist<string> temp = new arraylist<string>(); temp.add(item); temp.add(quant); temp.add(rate); temp.add(rs); t2rows.add(temp); } list<integer> t2colwidths = arrays.aslist(17, 9, 5, 12); string t3desc = "sub total"; list<string> t3headers = arrays.aslist("", "", "", ""); list<list<string>> t3rows = arrays.aslist( arrays.aslist("wr-dvd", "122.00", "7", "854.00") ); string summary = "" + "sub total\n"; string summaryval = "" + txt_total.gettext() + "\n"; string sign1 = "" + "------------thank you-------------\n"; string sign2 = "" + "-we value visit-\n"; string advertise = "-we value visit-"; try { board b = new board(48); b.setinitialblock(new block(b, 46, 7, company).allowgrid(false).setblockalign(block.block_centre).setdataalign(block.data_center)); b.appendtableto(0, board.append_below, new table(b, 48, t1headers, t1rows)); b.getblock(3).setbelowblock(new block(b, 46, 1, t2desc).setdataalign(block.data_center)); b.appendtableto(5, board.append_below, new table(b, 48, t2headers, t2rows, t2colwidths)); b.getblock(10).setbelowblock(new block(b, 46, 1, t3desc).setdataalign(block.data_center)); b.appendtableto(14, board.append_below, new table(b, 48, t3headers, t3rows, t2colwidths)); block summaryblock = new block(b, 35, 3, summary).allowgrid(false).setdataalign(block.data_middle_right); b.getblock(19).setbelowblock(summaryblock); block summaryvalblock = new block(b, 12, 3, summaryval).allowgrid(false).setdataalign(block.data_middle_right); summaryblock.setrightblock(summaryvalblock); block sign1block = new block(b, 24, 7, sign1).setdataalign(block.data_bottom_middle).allowgrid(false); summaryblock.setbelowblock(sign1block); sign1block.setrightblock(new block(b, 24, 7, sign2).setdataalign(block.data_bottom_middle).allowgrid(false)); sign1block.setbelowblock(new block(b, 48, 3, advertise).setdataalign(block.data_center).allowgrid(false)); system.out.println(b.invalidate().build().getpreview());
and output of above code is:
v.k autos larkana near rehmaniya masjid larkana police shopping center larkana cell: 0334-3269198, 0333-3910951 customer invoice +-----------------------+----------------------+ |info |customer | +-----------------------+----------------------+ |date: 2016/01/27 |mohammad rafi abro | |time: 23:23:49 |bill no:9 | +-----------------------+----------------------+ | selling details | +-----------------+---------+-----+------------+ |item | qty| rate| total| +-----------------+---------+-----+------------+ |nuts | 50| 25| 1250| +-----------------+---------+-----+------------+ | sub total | +-----------------+---------+-----+------------+ | | | | | +-----------------+---------+-----+------------+ |wr-dvd | 122.00| 7| 854.00| +-----------------+---------+-----+------------+ sub total 1250 ------------thank you-------- -we value visit- -we value visit-
but want output like:
v.k autos larkana near rehmaniya masjid larkana police shopping center larkana cell: 0334-3269198, 0333-3910951 customer invoice +-----------------------+----------------------+ |info |customer | +-----------------------+----------------------+ |date: 2016/01/27 |mohammad rafi abro | |time: 23:23:49 |bill no:9 | +-----------------------+----------------------+ | selling details | +-----------------+---------+-----+------------+ |item | qty| rate| total| +-----------------+---------+-----+------------+ |nuts | 50| 25| 1250| +-----------------+---------+-----+------------+ sub total 1250 ===== thank kind visit ===
and want reduce width too, current board width 48, when changes value 40 showing me error :( please can 1 me out through this.
finally, did myself after working night on code :) well, mr. clough wagu example.
my code here below:
string company = "" + "v.k autos larkana\n" + "near rehmaniya masjid larkana\n" + "police shopping center larkana\n" + "cell: 0334-3269198, 0333-3910951\n" + " \n" + "customer invoice" + " "; calendar cal = calendar.getinstance(); simpledateformat sdf = new simpledateformat("hh:mm:ss"); list<string> t1headers = arrays.aslist("info", "customer"); list<list<string>> t1rows = arrays.aslist( arrays.aslist("date: " + date + "", "" + txt_cnam.gettext()), arrays.aslist("time: " + sdf.format(cal.gettime()) + "", "bill no:" + billno + "") ); string t2desc = "selling details"; list<string> t2headers = arrays.aslist("item", "qty", "rate", "total"); list<list<string>> t2rows = new arraylist<list<string>>(); (int = 0; < tbl_sale.getrowcount(); i++) { string pid = tbl_sale.getvalueat(i, 0).tostring(); string item = tbl_sale.getvalueat(i, 1).tostring(); string quant = tbl_sale.getvalueat(i, 2).tostring(); string rate = tbl_sale.getvalueat(i, 3).tostring(); string rs = tbl_sale.getvalueat(i, 4).tostring(); arraylist<string> temp = new arraylist<string>(); temp.add(item); temp.add(quant); temp.add(rate); temp.add(rs); t2rows.add(temp); } list<integer> t2colwidths = arrays.aslist(16, 5, 7, 9); string t3desc = "sub total"; list<string> t3headers = arrays.aslist("", "", "", ""); list<list<string>> t3rows = arrays.aslist( arrays.aslist("wr-dvd", "122.00", "7", "854.00") ); string summary = "" + "sub total\n"; string summaryval = "" + txt_total.gettext() + "\n"; string sign1 = "" +"------thank visit------\n"; string sign2 = "" + "-we value visit-\n"; string advertise = "******** soulution abrosoft *******\n* abrosoft@outlook.com # 03337584273 *"; try { board b = new board(48); b.setinitialblock(new block(b, 40, 6, company).allowgrid(true).setblockalign(block.block_left).setdataalign(block.data_center)); b.appendtableto(0, board.append_below, new table(b, 42, t1headers, t1rows)); b.getblock(3).setbelowblock(new block(b, 40, 1, t2desc).setdataalign(block.data_center)); b.appendtableto(5, board.append_below, new table(b, 40, t2headers, t2rows, t2colwidths)); block summaryblock = new block(b, 30, 1, summary).setdataalign(block.data_top_right); b.getblock(10).setbelowblock(summaryblock); block summaryvalblock = new block(b, 9, 1, summaryval).setdataalign(block.data_top_right); summaryblock.setrightblock(summaryvalblock); block sign1block = new block(b, 40, 1, sign1).setdataalign(block.data_center); b.getblock(14).setbelowblock(sign1block); block sign2block = new block(b, 40, 2, advertise).setdataalign(block.data_center); b.getblock(16).setbelowblock(sign2block); system.out.println(b.invalidate().build().getpreview());
and output need :). output below:
+----------------------------------------+ | v.k autos larkana | | near rehmaniya masjid larkana | | police shopping center larkana | | cell: 0334-3269198, 0333-3910951 | | | | customer invoice | +--------------------+-------------------+ |info |customer | +--------------------+-------------------+ |date: 2016/01/28 |mohammad rafi abro | |time: 15:31:15 |bill no:10 | +--------------------+-------------------+ | selling details | +----------------+-----+-------+---------+ |item | qty| rate| total| +----------------+-----+-------+---------+ |nuts | 12| 25| 300| |70 cc | 12| 7000| 84000| |125 cc | 13| 95000| 1235000| |12 | 25| 2500| 62500| +----------------+-----+-------+---------+ | sub total| 1381800| +------------------------------+---------+ | ------thank visit------ | +----------------------------------------+ | ******** soulution abrosoft ******* | | * abrosoft@outlook.com # 03337584273 * | +----------------------------------------+
well, again mr. clough. :)
Comments
Post a Comment