class sendReport3 extends Thread { @Override public void run() { // for(int i=0; i0) { finalempstockdata.get(0).setQty(finalempstockdata.get(0).getQty()+qty); finalempstockdata.get(0).setDqty(finalempstockdata.get(0).getDqty()+dqty); finalempstockdata.get(0).setRemaining(finalempstockdata.get(0).getRemaining()+qty); finalempstockdata.get(0).setTotalamount(finalempstockdata.get(0).getTotalamount()+totalprice); Backendless.Persistence.of(employeestock.class).save(finalempstockdata.get(0)); } else { employeestock empsave = new employeestock(); empsave.setProduct(product); empsave.setBatchno(batch); empsave.setMfgdate(mfg); empsave.setExpdate(exp); empsave.setQty(qty); empsave.setDqty(dqty); empsave.setRemaining(qty); empsave.setMrp(price2); empsave.setPts(pts); empsave.setEmpcode(clientcode); empsave.setEmpname(dispatchedto); empsave.setType(type); empsave.setTotalamount(totalprice); Backendless.Persistence.of(employeestock.class).save(empsave); //YESTERDAY ERROR } } recact.setUser(username); recact.setActiondate(date1); recact.setTab("Dispatch"); recact.setType(clienttype); recact.setAction("Dispatch to "+dispatchedto); recact.setRaid(disid); recact.setCompleted("Employee Stock Updated"); Backendless.Persistence.of(recentactions.class).save(recact); } new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { tvLoad.setText("Updating Client Dispatch & Stock Data. Please Wait..."); } }); for (int i=0; i "+" RAH- "+rah+" TR- "+totr+" DQ- "+dispatchqty+" "; int finalqty = totr - (qty + dqty) ; int dispatchedqty = dispatchqty + qty + dqty; newvalues1 = newvalues1+" "+product+" <"+batch+"> "+" RAH- "+remainingqty+" TR- "+finalqty+" DQ- "+dispatchedqty; finalsavestockdata.get(0).setRemainingatho(remainingqty); finalsavestockdata.get(0).setRemaining(finalqty); finalsavestockdata.get(0).setStockdispatched(dispatchedqty); Backendless.Persistence.of(stockdata.class).save(finalsavestockdata.get(0)); //TODAYS ERROR } else if (from.equals( "FromGodown")) { int rag = finalsavestockdata.get(0).getRemainingatgodown(); int totr = finalsavestockdata.get(0).getRemaining(); int remainingqty = rag - (qty + dqty); int dispatchqty = finalsavestockdata.get(0).getStockdispatched(); oldvalues1 = oldvalues1+" "+product+" <"+batch+"> "+" RAG- "+rag+" TR- "+totr+" DQ- "+dispatchqty+" "; int finalqty = totr - (qty + dqty) ; int dispatchedqty = dispatchqty + qty + dqty; newvalues1 = newvalues1+" "+product+" <"+batch+"> "+" RAG- "+remainingqty+" TR- "+finalqty+" DQ- "+dispatchedqty; finalsavestockdata.get(0).setRemainingatgodown(remainingqty); finalsavestockdata.get(0).setRemaining(finalqty); finalsavestockdata.get(0).setStockdispatched(dispatchedqty); Backendless.Persistence.of(stockdata.class).save(finalsavestockdata.get(0)); } ClientDispatch clientDispatch = new ClientDispatch(); clientDispatch.setProduct(product); clientDispatch.setBatchno(batch); clientDispatch.setMfg(mfg); clientDispatch.setExpiry(exp); clientDispatch.setQty(qty); clientDispatch.setPrice(price2); clientDispatch.setDispatchedto(dispatchedto); clientDispatch.setClientcode(clientcode); clientDispatch.setClienttype(clienttype); clientDispatch.setDispatchedon(date1); clientDispatch.setUsername(username); clientDispatch.setDispatchid(id); clientDispatch.setOrdertotal(Math.round(totalprice)); clientDispatch.setDispatchno(disid); clientDispatch.setTotal(totalo); clientDispatch.setGst(GSTcheck); clientDispatch.setPts(pts); clientDispatch.setGstamount(GSTamount); clientDispatch.setAdjustment("NO"); clientDispatch.setComments(commentfinal); clientDispatch.setDiscqty(dqty); clientDispatch.setFrom(from.toUpperCase()); clientDispatch.setType(type); clientDispatch.setHq(hq); Backendless.Persistence.of(ClientDispatch.class).save(clientDispatch); } enteredvalues = enteredvalues + proprice1+proprice2+proprice3; oldvalues = oldvalues +oldvalues1+oldvalues2+oldvalues3; newvalues = newvalues + newvalues1+newvalues2+newvalues3; recact.setUser(username); recact.setActiondate(date1); recact.setTab("Dispatch"); recact.setType(clienttype); recact.setAction("Dispatch to "+dispatchedto); recact.setEnteredvalue(enteredvalues); recact.setOldvalue(oldvalues); recact.setNewvalue(newvalues); recact.setHq(hq); recact.setCompleted("Finished"); Backendless.Persistence.of(recentactions.class).save(recact); openLock(); new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { showProgress(false); Toast.makeText(dispatchnew.this, "Dispatch Report Sent", Toast.LENGTH_SHORT).show(); finish(); } }); } }