2 Copyright (C) 2011 by Cuong Le <metacuong@gmail.com>
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>
19 import "../DatePicker/component" as Comp
21 import "amlich-hnd.js" as AmLich
22 import "amlich-aa98.js" as AmLich98
24 import "CacNgayLeTrongNam.js" as CNLTN
31 anchors.fill: parent; anchors.bottomMargin: 0
37 width: grid.cellWidth; height: {
39 return grid.cellHeight - 15;
40 else return grid.cellHeight;
43 anchors.fill: parent;anchors.rightMargin: 2;anchors.topMargin: 2;
48 var stemp = AmLich98.convertSolar2Lunar(txtDATEpv.currentIndex+1,curMonth,curYear,7);
49 if (CNLTN.is_holiday(day, month, stemp[0], stemp[1]))
50 return theme_manager.theme.markdate.holidays;
56 text: name; anchors.horizontalCenter: parent.horizontalCenter
57 font.pixelSize: 21;font.bold: true;font.family: "Tahoma"
66 if (day==initcurDay && month==initcurMonth && year==initcurYear)
69 return "lightsteelblue";
82 LC.reset(day,month,year)
83 screen.calculateLunar(day,month,year)
84 screen.state="mainscreen"
87 txtDATEpv.currentIndex = day-1;
93 parent.color="#F0F0F0"
99 if (day==initcurDay && month==initcurMonth && year==initcurYear)
100 parent.color="#00EBEB";
102 parent.color="lightsteelblue";
104 parent.color="#AAAAAA";
111 {if (day==initcurDay && month==initcurMonth && year==initcurYear) parent.color="#00EBEB"; else parent.color="lightsteelblue";}
113 parent.color="#AAAAAA";
129 anchors.horizontalCenterOffset: 15
130 anchors.bottomMargin: -52
131 anchors.topMargin: 42
132 anchors.horizontalCenter: parent.horizontalCenter
133 anchors.bottom: parent.bottom
134 anchors.top: parent.top
135 cellWidth: 110; cellHeight: 50
136 //Dung : 64 | Nam :110
138 delegate: contactDelegate
145 Component.onCompleted: {
150 for(var i=0;i<42;i++){
151 append({header:false,name:"",inmonths:false,day:0,month:0,year:0})
156 header:true;inmonth:false;day:0;month:0;year:0
161 header:true;inmonth:false;day:0;month:0;year:0
166 header:true;inmonth:false;day:0;month:0;year:0
170 header:true;inmonth:false;day:0;month:0;year:0
174 header:true;inmonth:false;day:0;month:0;year:0
178 header:true;inmonth:false;day:0;month:0;year:0
182 header:true;inmonth:false;day:0;month:0;year:0
187 Component.onCompleted: {
192 ToolBarSingle { id: toolBar; height: 50;
195 button1Label: "Quay Về"
198 screen.state="mainscreen"
208 height: screen.height
210 if (screen.width>=800)
219 function get_prevmonth(startfrom){
220 var cMonth=screen.curMonth;
221 var cYear=screen.curYear;
228 var daysofthemonthyear = LC.calDays(cMonth,cYear);
229 for (var i=daysofthemonthyear;i>daysofthemonthyear-startfrom;i--){
230 var lunarcl = AmLich.getLunarDate(i,cMonth,cYear)
231 pmonth.push({duong:i, am:lunarcl.day, month:cMonth, year:cYear})
233 return pmonth.reverse()
236 function get_nextmonth(startfrom){
237 var cMonth=screen.curMonth;
238 var cYear=screen.curYear;
246 for (var i=1;i<=startfrom;i++){
247 var lunarcl = AmLich.getLunarDate(i,cMonth,cYear)
248 pmonth.push({duong:i, am:lunarcl.day, month:cMonth, year:cYear});
250 return pmonth.reverse();
254 var firstdayofthemonthyear = AmLich.getLunarDate(1,screen.curMonth,screen.curYear).jd;
255 var startfrom = (firstdayofthemonthyear+1)%7;
256 var daysofthemonthyear = LC.calDays(screen.curMonth,screen.curYear);
261 var nextmonth = get_nextmonth(totalslot - (startfrom+daysofthemonthyear))
262 var prevmonth = get_prevmonth(startfrom)
264 var dayclick, monthclick, yearclick;
266 while(lmodel.count>7){
267 lmodel.remove(lmodel.count-1);
270 var datas1,datas,lunarclmonth,inmonths;
272 for (var i=7;i<49;i++){
273 var realnumber = i - 7;
274 if (realnumber >= startfrom && j<= daysofthemonthyear){
275 var lunarcl = AmLich.getLunarDate(j,screen.curMonth,screen.curYear)
277 lunarclmonth = "/"+lunarcl.month
282 datas = j+"<br><span style='font-size:18px;float:right;color:#700070;'> "+lunarcl.day+lunarclmonth+"</span>";
284 monthclick = screen.curMonth;
285 yearclick = screen.curYear;
289 if (realnumber<startfrom){
290 datas1= prevmonth[realnumber];
293 datas1=nextmonth[(totalslot-realnumber)-1];
295 dayclick = datas1.duong;
296 monthclick = datas1.month;
297 yearclick = datas1.year;
298 datas = "<span style='color:grey;font-weight:normal;'>"+datas1.duong+"</span><br><span style='font-size:18px;float:right;color:#CCFFFF;'> "+datas1.am+"</span>";
302 lmodel.append({header:false,name:datas,inmonth:inmonths,day:dayclick,month:monthclick,year:yearclick})