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 3 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
38 width: grid.cellWidth; height: {
40 return grid.cellHeight - 15;
41 else return grid.cellHeight;
44 anchors.fill: parent;anchors.rightMargin: 2;anchors.topMargin: 2;
49 var stemp = AmLich98.convertSolar2Lunar(txtDATEpv.currentIndex+1,curMonth,curYear,7);
50 if (CNLTN.is_holiday(day, month, stemp[0], stemp[1]))
51 return theme_manager.theme.markdate.holidays;
57 text: name; anchors.horizontalCenter: parent.horizontalCenter
58 font.pixelSize: 21;font.bold: true;font.family: "Tahoma"
67 if (day==initcurDay && month==initcurMonth && year==initcurYear)
70 return "lightsteelblue";
83 LC.reset(day,month,year)
84 screen.calculateLunar(day,month,year)
85 screen.state="mainscreen"
88 txtDATEpv.currentIndex = day-1;
94 parent.color="#F0F0F0"
100 if (day==initcurDay && month==initcurMonth && year==initcurYear)
101 parent.color="#00EBEB";
103 parent.color="lightsteelblue";
105 parent.color="#AAAAAA";
112 {if (day==initcurDay && month==initcurMonth && year==initcurYear) parent.color="#00EBEB"; else parent.color="lightsteelblue";}
114 parent.color="#AAAAAA";
130 anchors.horizontalCenterOffset: 15
131 anchors.bottomMargin: -52
132 anchors.topMargin: 42
133 anchors.horizontalCenter: parent.horizontalCenter
134 anchors.bottom: parent.bottom
135 anchors.top: parent.top
136 cellWidth: 110; cellHeight: 50
137 //Dung : 64 | Nam :110
139 delegate: contactDelegate
146 Component.onCompleted: {
151 for(var i=0;i<42;i++){
152 append({header:false,name:"",inmonths:false,day:0,month:0,year:0})
157 header:true;inmonth:false;day:0;month:0;year:0
162 header:true;inmonth:false;day:0;month:0;year:0
167 header:true;inmonth:false;day:0;month:0;year:0
171 header:true;inmonth:false;day:0;month:0;year:0
175 header:true;inmonth:false;day:0;month:0;year:0
179 header:true;inmonth:false;day:0;month:0;year:0
183 header:true;inmonth:false;day:0;month:0;year:0
188 Component.onCompleted: {
193 ToolBarSingle { id: toolBar; height: 50;
196 button1Label: "Quay Về"
199 screen.state="mainscreen"
204 Transition { NumberAnimation { properties: "x,y,opacity"; duration: 500; easing.type: Easing.InOutBack } }
213 height: screen.height
215 if (screen.width>=800)
224 function get_prevmonth(startfrom){
225 var cMonth=screen.curMonth;
226 var cYear=screen.curYear;
233 var daysofthemonthyear = LC.calDays(cMonth,cYear);
234 for (var i=daysofthemonthyear;i>daysofthemonthyear-startfrom;i--){
235 var lunarcl = AmLich.getLunarDate(i,cMonth,cYear)
236 pmonth.push({duong:i, am:lunarcl.day, month:cMonth, year:cYear})
238 return pmonth.reverse()
241 function get_nextmonth(startfrom){
242 var cMonth=screen.curMonth;
243 var cYear=screen.curYear;
251 for (var i=1;i<=startfrom;i++){
252 var lunarcl = AmLich.getLunarDate(i,cMonth,cYear)
253 pmonth.push({duong:i, am:lunarcl.day, month:cMonth, year:cYear});
255 return pmonth.reverse();
259 var firstdayofthemonthyear = AmLich.getLunarDate(1,screen.curMonth,screen.curYear).jd;
260 var startfrom = (firstdayofthemonthyear+1)%7;
261 var daysofthemonthyear = LC.calDays(screen.curMonth,screen.curYear);
266 var nextmonth = get_nextmonth(totalslot - (startfrom+daysofthemonthyear))
267 var prevmonth = get_prevmonth(startfrom)
269 var dayclick, monthclick, yearclick;
271 while(lmodel.count>7){
272 lmodel.remove(lmodel.count-1);
275 var datas1,datas,lunarclmonth,inmonths;
277 for (var i=7;i<49;i++){
278 var realnumber = i - 7;
279 if (realnumber >= startfrom && j<= daysofthemonthyear){
280 var lunarcl = AmLich.getLunarDate(j,screen.curMonth,screen.curYear)
282 lunarclmonth = "/"+lunarcl.month
287 datas = j+"<br><span style='font-size:18px;float:right;color:#700070;'> "+lunarcl.day+lunarclmonth+"</span>";
289 monthclick = screen.curMonth;
290 yearclick = screen.curYear;
294 if (realnumber<startfrom){
295 datas1= prevmonth[realnumber];
298 datas1=nextmonth[(totalslot-realnumber)-1];
300 dayclick = datas1.duong;
301 monthclick = datas1.month;
302 yearclick = datas1.year;
303 datas = "<span style='color:grey;font-weight:normal;'>"+datas1.duong+"</span><br><span style='font-size:18px;float:right;color:#CCFFFF;'> "+datas1.am+"</span>";
307 lmodel.append({header:false,name:datas,inmonth:inmonths,day:dayclick,month:monthclick,year:yearclick})