feature/cash_bookings #55
@ -75,11 +75,6 @@ public class RequestController {
 | 
			
		||||
        return "redirect:/";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @GetMapping("/intern/")
 | 
			
		||||
    public String intern() {
 | 
			
		||||
        return "intern/index";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @GetMapping("/intern/customerOrders/")
 | 
			
		||||
    public String internCustomerOrder() {
 | 
			
		||||
        return "intern/customerOrders/index";
 | 
			
		||||
 | 
			
		||||
@ -1,8 +1,34 @@
 | 
			
		||||
package org.hso.ecommerce.controller.intern;
 | 
			
		||||
 | 
			
		||||
import java.util.Optional;
 | 
			
		||||
 | 
			
		||||
import org.hso.ecommerce.controller.intern.accounting.AccountingController;
 | 
			
		||||
import org.hso.ecommerce.entities.booking.BookingAccountEntry;
 | 
			
		||||
import org.hso.ecommerce.repos.booking.BookingAccountEntryRepository;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.stereotype.Controller;
 | 
			
		||||
import org.springframework.ui.Model;
 | 
			
		||||
import org.springframework.web.bind.annotation.GetMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestMapping;
 | 
			
		||||
 | 
			
		||||
@Controller
 | 
			
		||||
//@RequestMapping("...")
 | 
			
		||||
@RequestMapping("/intern")
 | 
			
		||||
public class InternIndexController {
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private final BookingAccountEntryRepository bookingAccountEntryRepository = null;
 | 
			
		||||
 | 
			
		||||
    @GetMapping("/")
 | 
			
		||||
    public String intern(Model model) {
 | 
			
		||||
        Optional<BookingAccountEntry> mainAccount = bookingAccountEntryRepository.getByMain();
 | 
			
		||||
        int mainAccountBalance = mainAccount.map(entry -> entry.newSumCent).orElse(0);
 | 
			
		||||
        Optional<BookingAccountEntry> vatAccount = bookingAccountEntryRepository.getByVat();
 | 
			
		||||
        int vatAccountBalance = vatAccount.map(entry -> entry.newSumCent).orElse(0);
 | 
			
		||||
 | 
			
		||||
        model.addAttribute("mainAccountBalance", AccountingController.fmtEuro(mainAccountBalance));
 | 
			
		||||
        model.addAttribute("vatAccountBalance", AccountingController.fmtEuro(vatAccountBalance));
 | 
			
		||||
 | 
			
		||||
        return "intern/index";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -116,7 +116,7 @@ public class AccountingController {
 | 
			
		||||
        return new ShortTemplateBookingResult(balance, templateBookings);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private String fmtEuro(long amountCent) {
 | 
			
		||||
    public static String fmtEuro(long amountCent) {
 | 
			
		||||
        return String.format("%.2f EUR", amountCent / 100.0);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -88,12 +88,12 @@
 | 
			
		||||
        <div class="grid xl">
 | 
			
		||||
            <section class="primary hero">
 | 
			
		||||
                <h3>Hauptkonto</h3>
 | 
			
		||||
                <h2>4080,00 EUR</h2>
 | 
			
		||||
                <h2 th:text="${mainAccountBalance}" />
 | 
			
		||||
            </section>
 | 
			
		||||
 | 
			
		||||
            <section class="primary hero">
 | 
			
		||||
                <h3>Umsatzsteuerkonto</h3>
 | 
			
		||||
                <h2>-505,00 EUR</h2>
 | 
			
		||||
                <h2 th:text="${vatAccountBalance}" />
 | 
			
		||||
            </section>
 | 
			
		||||
 | 
			
		||||
            <section class="spacer"></section>
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user