3 Qt.include("amlich-hnd.js");
4 Qt.include("amlich-aa98.js");
5 Qt.include("Settings.js");
6 Qt.include("Themes.js");
7 Qt.include("CacNgayLeTrongNam.js");
8 Qt.include("xemngaytotxau.js");
10 var localdate = new Date();
12 var curDay=localdate.getDate();
13 var curMonth=localdate.getMonth()+1;
14 var curYear=localdate.getFullYear();
20 var lunarDay = getLunarDate(curDay,curMonth,curYear).day;
21 var lunarMonth = getLunarDate(curDay,curMonth,curYear).month;
22 var lunarYear = getCanChi(getLunarDate(curDay,curMonth,curYear))[2];
23 var lunarYearInt = getLunarDate(curDay,curMonth,curYear).year;
24 var jd = getLunarDate(curDay,curMonth,curYear).jd;
25 var lunarGioHoangDao = getGioHoangDao(jd);
27 var lunarDayCanChi = getCanChi(getLunarDate(curDay,curMonth,curYear))[0];
28 var lunarMonthCanChi = getCanChi(getLunarDate(curDay,curMonth,curYear))[1];
30 var day_info = get(curDay,curMonth, curYear, lunarDay, lunarMonth);
31 var isholiday = is_holiday(curDay,curMonth, curYear, lunarDay, lunarMonth);
39 initcurMonth = curMonth;
40 initcurYear = curYear;
48 if (curMonth == 4 || curMonth == 6 || curMonth == 9 || curMonth == 11)
52 var isLeapYear = (curYear % 4 === 0 && curYear % 100 !== 0) || (curYear % 400 ===0);
61 function calDaysX(month, year){
62 if (month == 4 || month == 6 || month == 9 || month == 11)
66 var isLeapYear = (year % 4 === 0 && year % 100 !== 0) || (year % 400 ===0);
80 function lunarTietKhi(){
81 return TIETKHI[getSunLongitude(jd+1,7.0)];
84 function reset_to_default_day(txtTHU, txtInfo, txtDAYAmLich){
85 localdate = new Date();
87 curDay=localdate.getDate();
88 curMonth=localdate.getMonth()+1;
89 curYear=localdate.getFullYear();
91 changeDay(curDay, txtTHU, txtInfo, txtDAYAmLich);
94 function changeDay(newday, txtTHU, txtInfo, txtDAYAmLich){
98 txtTHU.text=__txtTHU_format();
99 txtInfo.text=__txtInfo_format();
100 txtDAYAmLich.text=__txtDAYAmLich_format();
103 function createDateTimeDialog(parent){
104 datetimedlg = createObject("DateTimeDialog.qml", parent);
105 amdatetimedlg = createObject("AmDateTimeDialog.qml", parent);
106 fullmonth = createObject("FullMonth.qml", parent);
109 function __txtTHU_format(){
113 function __txtInfo_format(){
117 function __txtDAYAmLich_format(){
118 return "Ngày <b>"+lunarDay+" ("+lunarDayCanChi+")</b><br>Tháng <b>"+lunarMonth+" ("+lunarMonthCanChi+")</b><br>Năm <b>"+lunarYearInt+" ("+lunarYear+")</b>";
121 function recalculate(){
122 lunarDay = getLunarDate(curDay,curMonth,curYear).day;
123 lunarMonth = getLunarDate(curDay,curMonth,curYear).month;
124 lunarYear = getCanChi(getLunarDate(curDay,curMonth,curYear))[2];
125 lunarYearInt = getLunarDate(curDay,curMonth,curYear).year;
126 jd = getLunarDate(curDay,curMonth,curYear).jd;
127 lunarGioHoangDao = getGioHoangDao(jd);
129 lunarDayCanChi = getCanChi(getLunarDate(curDay,curMonth,curYear))[0];
130 lunarMonthCanChi = getCanChi(getLunarDate(curDay,curMonth,curYear))[1];
132 day_info = get(curDay,curMonth, lunarDay, lunarMonth);
133 isholiday = is_holiday(curDay,curMonth, curYear, lunarDay, lunarMonth);
136 function createObject(sourceFile, parentObject) {
137 var component = Qt.createComponent(sourceFile);
138 var guiObject = component.createObject(parentObject);
140 if (guiObject === null) {
141 console.log("Error creating object");