package com.jasamedika.medifirst2000.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.jasamedika.medifirst2000.dao.DaftarPenerimaanLinenDao;
import com.jasamedika.medifirst2000.dto.DaftarPenerimaanLinenDto;
import com.jasamedika.medifirst2000.service.DaftarPenerimaanLinenService;
import com.jasamedika.medifirst2000.util.CommonUtil;

@Service("DaftarPenerimaanLinenService")
public class DaftarPenerimaanLinenServiceImpl implements DaftarPenerimaanLinenService {

	@Autowired
	private DaftarPenerimaanLinenDao daftarPenerimaanLinenDao;

	@Override
	public Map<String, Object> findDaftarPenerimaanLinenByTgl(String tglAwal, String tglAkhir) {

		Map<String, Object> result = new HashMap<String, Object>();
		try {
			System.out.println("=====================START DAFTAR PENERIMAAN LINEN====================");
			List<DaftarPenerimaanLinenDto> resultModel = daftarPenerimaanLinenDao
					.findDaftarPenerimaanLinenByTgl(tglAwal, tglAkhir);
			if (CommonUtil.isNotNullOrEmpty(resultModel)) {
				result.put("Daftar Penerimaan Linen", resultModel);
				result.put("Daftar Penerimaan Linen Ada", true);
			} else {
				result.put("Daftar Penerimaan Linen Tidak Ada", false);
			}
			System.out.println("=====================END DAFTAR PENERIMAAN LINEN====================");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return result;
	}

}
