Search in sources :

Example 1 with PrinterServiceImpl

use of org.openmrs.module.printer.PrinterServiceImpl in project openmrs-module-mirebalais by PIH.

the class WristbandTemplateTest method testWristbandHack.

@Test
@Ignore
public void testWristbandHack() throws UnableToPrintViaSocketException {
    int i = 0;
    while (i < 1) {
        StringBuffer data = new StringBuffer();
        data.append("^XA");
        // specify Unicode encoding
        data.append("^CI28");
        // set direct transfer type
        data.append("^MTD");
        // set orientation
        data.append("^FWB");
        // demographics
        data.append("^FO050,200^FB2150,1,0,L,0^AS^FDHôpital Universitaire de Mirebalais  19-May-2014^FS");
        data.append("^FO100,200^FB2150,1,0,L,0^AU^FDRingo Starr^FS");
        data.append("^FO160,200^FB2150,1,0,L,0^AU^FD07 Jul 1940^FS");
        data.append("^FO160,200^FB1850,1,0,L,0^AT^FD40 years^FS");
        data.append("^FO160,200^FB1650,1,0,L,0^AU^FDMale  A 000005^FS");
        data.append("^FO220,200^FB2150,1,0,L,0^AS^FDAvant Eglise Chretienne des perlerlerin de la siant tete de moliere^FS");
        data.append("^FO270,200^FB2150,1,0,L,0^AS^FDSaut D'Eau, 1ere Riviere Canot, Saut d'Eau, Centre^FS");
        // barcode
        data.append("^FO100,2400^AT^BY4^BC,150,N^FDABC^XZ");
        Printer printer = new Printer();
        printer.setIpAddress("10.3.18.113");
        printer.setPort("9100");
        printer.setId(1);
        new PrinterServiceImpl().printViaSocket(data.toString(), printer, "UTF-8");
        i++;
    }
}
Also used : Printer(org.openmrs.module.printer.Printer) PrinterServiceImpl(org.openmrs.module.printer.PrinterServiceImpl) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 2 with PrinterServiceImpl

use of org.openmrs.module.printer.PrinterServiceImpl in project openmrs-module-pihcore by PIH.

the class WristbandTemplateTest method testWristbandHack.

@Test
@Ignore
public void testWristbandHack() throws UnableToPrintViaSocketException {
    int i = 0;
    while (i < 1) {
        StringBuffer data = new StringBuffer();
        data.append("^XA");
        // specify Unicode encoding
        data.append("^CI28");
        // set direct transfer type
        data.append("^MTD");
        // set orientation
        data.append("^FWB");
        // demographics
        data.append("^FO050,200^FB2150,1,0,L,0^AS^FDMirebalais  19-May-2014^FS");
        data.append("^FO100,200^FB2150,1,0,L,0^AU^FDRingo Starr^FS");
        data.append("^FO160,200^FB2150,1,0,L,0^AU^FD07 Jul 1940^FS");
        data.append("^FO160,200^FB1850,1,0,L,0^AT^FD40 years^FS");
        data.append("^FO160,200^FB1650,1,0,L,0^AU^FDMale  A 000005^FS");
        data.append("^FO220,200^FB2150,1,0,L,0^AS^FDAvant Eglise Chretienne des perlerlerin de la siant tete de moliere^FS");
        data.append("^FO270,200^FB2150,1,0,L,0^AS^FDSaut D'Eau, 1ere Riviere Canot, Saut d'Eau, Centre^FS");
        // barcode
        data.append("^FO100,2400^AT^BY4^BC,150,N^FDABC^XZ");
        Printer printer = new Printer();
        printer.setIpAddress("10.3.18.113");
        printer.setPort("9100");
        printer.setId(1);
        new PrinterServiceImpl().printViaSocket(data.toString(), printer, "UTF-8");
        i++;
    }
}
Also used : Printer(org.openmrs.module.printer.Printer) PrinterServiceImpl(org.openmrs.module.printer.PrinterServiceImpl) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 3 with PrinterServiceImpl

use of org.openmrs.module.printer.PrinterServiceImpl in project openmrs-module-pihcore by PIH.

the class ZplLabLabelTemplateTest method shouldPrintToPrinter.

@Test
// just used to print against a test printer when one is on the network
@Ignore
public void shouldPrintToPrinter() throws Exception {
    Patient patient = new Patient();
    PersonName name = new PersonName();
    name.setGivenName("Mark");
    name.setFamilyName("Goodrich");
    patient.addName(name);
    PatientIdentifier patientIdentifier = new PatientIdentifier();
    patientIdentifier.setIdentifier("YXB123");
    patientIdentifier.setIdentifierType(primaryIdentifierType);
    patient.addIdentifier(patientIdentifier);
    String data = template.generateLabel(patient);
    Printer printer = new Printer();
    printer.setIpAddress("10.10.216.207");
    printer.setPort("9100");
    printer.setId(1);
    Map<String, Object> paramMap = new HashMap<String, Object>();
    paramMap.put("data", data);
    paramMap.put("encoding", "UTF-8");
    new PrinterServiceImpl().print(paramMap, printer, false, new SocketPrintHandler());
}
Also used : PersonName(org.openmrs.PersonName) HashMap(java.util.HashMap) Patient(org.openmrs.Patient) Printer(org.openmrs.module.printer.Printer) PrinterServiceImpl(org.openmrs.module.printer.PrinterServiceImpl) PatientIdentifier(org.openmrs.PatientIdentifier) SocketPrintHandler(org.openmrs.module.printer.handler.SocketPrintHandler) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

Ignore (org.junit.Ignore)3 Test (org.junit.Test)3 Printer (org.openmrs.module.printer.Printer)3 PrinterServiceImpl (org.openmrs.module.printer.PrinterServiceImpl)3 HashMap (java.util.HashMap)1 Patient (org.openmrs.Patient)1 PatientIdentifier (org.openmrs.PatientIdentifier)1 PersonName (org.openmrs.PersonName)1 SocketPrintHandler (org.openmrs.module.printer.handler.SocketPrintHandler)1