/****************************************************** * Function name : button1_Click * Description : 生成函数 * Variables : object sender, EventArgs e ******************************************************/ private void button1_Click(object sender, EventArgs e) { TicketCreator tc = new TicketCreator(); tc.setOperatorInfo("益庄店", "321304", "0018", "3123"); tc.addGoods("雪碧", 2, 2.0); tc.addGoods("烤鸭", 1, 15.5); tc.addGoods("青岛啤酒灌装", 3, 4.5); tc.addNotes("商品质量问题七日内退换"); tc.addNotes("客服电话:0311-68093454/966118"); tc.generatePDF("H:\\mySoftware\\PDFTests", 50); }
/************************************************ * Function name : generateTicketInterface * Description : 小票生成接口 * Variables : string TICKET, string EMPLOYEE, string[] PHONENAME, int[] price, int[] amount ************************************************/ public bool generateTicketInterface(string TICKET, string EMPLOYEE, string[] PHONENAME, int[] price, int[] amount) { bool flag = true; try { // 在调用该类的函数中创建类的实例 TicketCreator tc = new TicketCreator(); // 设置店铺及操作人员等身份信息 tc.setOperatorInfo("总店", TICKET, "001", EMPLOYEE); // 添加商品信息 int i = 0; for (i = 0; i < PHONENAME.Length; i++) { tc.addGoods(PHONENAME[i], amount[i], price[i]); } // 根据店铺需要添加小票备注 tc.addNotes("谢谢惠顾"); // 可设置是否生成条码 tc.setCodeCreatorOpened(true); // 开始生成 tc.generatePDF("D:", 50); } catch (Exception e) { flag = false; } return(flag); }