private void cmd_annotateDifference(){
  BigDecimal previousValue, actualValue, difference;
  previousValue=(BigDecimal)v_previousBalance.getValue();
  actualValue=(BigDecimal)v_ActualBalance.getValue();
  difference=actualValue.subtract(previousValue);
  MCashBook cashBook=new MCashBook(p_ctx,p_pos.getC_CashBook_ID(),null);
  Timestamp today=TimeUtil.getDay(System.currentTimeMillis());
  MCash cash=MCash.get(p_ctx,cashBook.getC_CashBook_ID(),today,null);
  if (cash != null && cash.get_ID() != 0 && difference.compareTo(cash.getStatementDifference()) != 0) {
    MCashLine cl=new MCashLine(cash);
    cl.setCashType(MCashLine.CASHTYPE_Difference);
    cl.setAmount(difference);
    cl.setDescription(Msg.translate(p_pos.getCtx(),"Cash Scrutiny -> Before: ") + previousValue + " Now: "+ actualValue);
    cl.saveEx();
  }
  cash=MCash.get(p_pos.getCtx(),p_pos.getC_CashBook_ID(),today,null);
  v_previousBalance.setValue(cash.getEndingBalance());
  v_ActualBalance.setValue(Env.ZERO);
  v_difference.setValue(Env.ZERO);
}

private void cmd_annotateDifference ( ) { BigDecimal previousValue , actualValue , difference ; previousValue = ( BigDecimal ) v_previousBalance . getValue ( ) ; actualValue = ( BigDecimal ) v_ActualBalance . getValue ( ) ; difference = actualValue . subtract ( previousValue ) ; MCashBook cashBook = new MCashBook ( p_ctx , p_pos . getC_CashBook_ID ( ) , null ) ; Timestamp today = TimeUtil . getDay ( System . currentTimeMillis ( ) ) ; MCash cash = MCash . get ( p_ctx , cashBook . getC_CashBook_ID ( ) , today , null ) ; if ( cash != null && cash . get_ID ( ) != 0 && difference . compareTo ( cash . getStatementDifference ( ) ) != 0 ) { MCashLine cl = new MCashLine ( cash ) ; cl . setCashType ( MCashLine . CASHTYPE_Difference ) ; cl . setAmount ( difference ) ; cl . setDescription ( Msg . translate ( p_pos . getCtx ( ) , "Cash Scrutiny -> Before: " ) + previousValue + " Now: " + actualValue ) ; cl . saveEx ( ) ; } cash = MCash . get ( p_pos . getCtx ( ) , p_pos . getC_CashBook_ID ( ) , today , null ) ; v_previousBalance . setValue ( cash . getEndingBalance ( ) ) ; v_ActualBalance . setValue ( Env . ZERO ) ; v_difference . setValue ( Env . ZERO ) ; }
annotate the difference between previous balance and actual from cash scrutiny in the cash book
