List of usage examples for org.joda.time LocalDate now
public static LocalDate now()
ISOChronology
in the default time zone. From source file:ru.codemine.ccms.service.SalesService.java
License:Open Source License
public Double getMidExpences(Shop shop, int months) { if (months <= 0) return -1.0; LocalDate endDate = LocalDate.now().minusMonths(1).dayOfMonth().withMaximumValue(); LocalDate startDate = endDate.withDayOfMonth(1).minusMonths(months - 1); Double expTotal = getTotalExpenceValueForPeriod(shop, startDate, endDate); Double result = Math.round(expTotal / months * 100.0) / 100.0; return result; }
From source file:ru.codemine.ccms.service.SalesService.java
License:Open Source License
public Double getMidCleanSales(Shop shop, int months) { if (months <= 0) return -1.0; LocalDate endDate = LocalDate.now().minusMonths(1).dayOfMonth().withMaximumValue(); LocalDate startDate = endDate.withDayOfMonth(1).minusMonths(months - 1); Double cleanSales = getSalesValueByPeriod(shop, startDate, endDate) - getTotalExpenceValueForPeriod(shop, startDate, endDate); Double result = Math.round(cleanSales / months * 100.0) / 100.0; return result; }
From source file:ru.codemine.ccms.utils.Utils.java
License:Open Source License
/** * ? //from w ww .j a v a2 s . c om * @param title * -? * @param mainMenuActiveItem * ? * @param sideMenuActiveItem * ? * @param dateMonth * ?? * @param dateYear * * @return */ public Map<String, Object> prepareModel(String dateMonth, String dateYear) { Map<String, Object> modelMap = prepareModel(); modelMap.put("monthList", getMonthStrings()); modelMap.put("yearList", getYearStrings()); modelMap.put("selectedMonth", dateMonth == null ? LocalDate.now().toString("MMMM") : dateMonth); modelMap.put("selectedYear", dateYear == null ? LocalDate.now().toString("YYYY") : dateYear); return modelMap; }
From source file:ru.codemine.ccms.utils.Utils.java
License:Open Source License
/** * - //from w w w . j av a 2s.c om * @param dateMonth * ?? * @param dateYear * * @return */ public Map<Shop, SalesMeta> getShopSalesMap(String dateMonth, String dateYear) { LocalDate selectedStartDate; LocalDate selectedEndDate; DateTimeFormatter formatter = DateTimeFormat.forPattern("dd MMMM YYYY"); if (dateMonth != null && dateYear != null) // { selectedStartDate = formatter.parseLocalDate("01 " + dateMonth + " " + dateYear); selectedEndDate = selectedStartDate.dayOfMonth().withMaximumValue(); } else // - ??, { selectedStartDate = LocalDate.now().withDayOfMonth(1); selectedEndDate = selectedStartDate.dayOfMonth().withMaximumValue(); } List<Shop> shopList = shopService.getAllOpen(); Map<Shop, SalesMeta> salesMap = new LinkedHashMap(); for (Shop shop : shopList) { SalesMeta sm = salesService.getByShopAndDate(shop, selectedStartDate, selectedEndDate); if (shop.isCountersEnabled()) { for (Sales sales : sm.getSales()) { Counter counter = counterService.getByShopAndDate(shop, sales.getDate().toDateTime(LocalTime.MIDNIGHT)); sales.setPassability(counter == null ? 0 : counter.getIn()); } } salesMap.put(shop, sm); } return salesMap; }
From source file:ru.codemine.pos.ui.windows.selector.PeriodSelector.java
License:Open Source License
public PeriodSelector() { setTitle(" "); setSize(400, 200);//from w w w. ja va 2 s . co m setLocationRelativeTo(null); dateStartLabel = new WebLabel("? "); dateEndLabel = new WebLabel(" "); dateStartField = new WebDateField(LocalDate.now().toDate()); dateEndField = new WebDateField(LocalDate.now().toDate()); selectButton = new WebButton("", new ImageIcon("images/icons/default/16x16/button-ok.png")); cancelButton = new WebButton("", new ImageIcon("images/icons/default/16x16/button-cancel.png")); selectButton.setMargin(5); cancelButton.setMargin(5); selectButton.setRound(StyleConstants.largeRound); cancelButton.setRound(StyleConstants.largeRound); buttonsGroupPanel = new GroupPanel(10, selectButton, cancelButton); TableLayout layout = new TableLayout(new double[][] { { 10, TableLayout.PREFERRED, 10, TableLayout.FILL, 10 }, { 10, TableLayout.PREFERRED, 10, TableLayout.PREFERRED, 10, TableLayout.FILL, 10, TableLayout.PREFERRED, 10 } }); setLayout(layout); add(dateStartLabel, "1, 1"); add(dateStartField, "3, 1"); add(dateEndLabel, "1, 3"); add(dateEndField, "3, 3"); add(buttonsGroupPanel, "1, 7, 3, 7, C, T"); clientWindow = null; }
From source file:shiver.me.timbers.data.random.test.DateMatchers.java
License:Apache License
private static LocalDate today() { return LocalDate.now(); }
From source file:shiver.me.timbers.data.random.test.DateMatchers.java
License:Apache License
public static int maxDaysLastMoneth() { return LocalDate.now().minusMonths(1).dayOfMonth().getMaximumValue(); }
From source file:shiver.me.timbers.data.random.test.DateMatchers.java
License:Apache License
public static int maxDaysThisMoneth() { return LocalDate.now().dayOfMonth().getMaximumValue(); }
From source file:shiver.me.timbers.data.random.test.DateMatchers.java
License:Apache License
public static int maxDaysNextMoneth() { return LocalDate.now().plusMonths(1).dayOfMonth().getMaximumValue(); }
From source file:stali.SearchDemo.java
private void tSearchKeyReleased(java.awt.event.KeyEvent evt) { // TODO add your handling core here: if (evt.getKeyCode() == 10) { String line = "\n" + tSearch.getText() + "\t" + LocalDate.now(); dest.setText(dest.getText() + line); tSearch.setText(""); }//from w ww . j ava 2s .com }