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;
52 return "#000000"//"#007070"
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";
128 anchors.horizontalCenterOffset: 15
129 anchors.bottomMargin: -52
130 anchors.topMargin: 42
131 anchors.horizontalCenter: parent.horizontalCenter
132 anchors.bottom: parent.bottom
133 anchors.top: parent.top
134 cellWidth: 110; cellHeight: 50
136 boundsBehavior:Flickable.DragAndOvershootBounds
137 flickableDirection:Flickable.VerticalFlick
140 delegate: contactDelegate
144 /* var newMonth = screen.curMonth+1;
145 LC.reset(screen.curDay,newMonth,screen.curYear)
146 screen.calculateLunar(screen.curDay,newMonth,screen.curYear)
156 Component.onCompleted: {
161 for(var i=0;i<42;i++){
162 append({header:false,name:"",inmonths:false,day:0,month:0,year:0})
167 header:true;inmonth:false;day:0;month:0;year:0
172 header:true;inmonth:false;day:0;month:0;year:0
177 header:true;inmonth:false;day:0;month:0;year:0
181 header:true;inmonth:false;day:0;month:0;year:0
185 header:true;inmonth:false;day:0;month:0;year:0
189 header:true;inmonth:false;day:0;month:0;year:0
193 header:true;inmonth:false;day:0;month:0;year:0
198 Component.onCompleted: {
203 ToolBarSingle { id: toolBar; height: 50;
206 button1Label: "Quay Về"
209 screen.state="mainscreen"
219 height: screen.height
221 if (screen.width>=800)
230 function get_prevmonth(startfrom){
231 var cMonth=screen.curMonth;
232 var cYear=screen.curYear;
239 var daysofthemonthyear = LC.calDays(cMonth,cYear);
240 for (var i=daysofthemonthyear;i>daysofthemonthyear-startfrom;i--){
241 var lunarcl = AmLich.getLunarDate(i,cMonth,cYear)
242 pmonth.push({duong:i, am:lunarcl.day, month:cMonth, year:cYear})
244 return pmonth.reverse()
247 function get_nextmonth(startfrom){
248 var cMonth=screen.curMonth;
249 var cYear=screen.curYear;
257 for (var i=1;i<=startfrom;i++){
258 var lunarcl = AmLich.getLunarDate(i,cMonth,cYear)
259 pmonth.push({duong:i, am:lunarcl.day, month:cMonth, year:cYear});
261 return pmonth.reverse();
265 var firstdayofthemonthyear = AmLich.getLunarDate(1,screen.curMonth,screen.curYear).jd;
266 var startfrom = (firstdayofthemonthyear+1)%7;
267 var daysofthemonthyear = LC.calDays(screen.curMonth,screen.curYear);
272 var nextmonth = get_nextmonth(totalslot - (startfrom+daysofthemonthyear))
273 var prevmonth = get_prevmonth(startfrom)
275 var dayclick, monthclick, yearclick;
277 while(lmodel.count>7){
278 lmodel.remove(lmodel.count-1);
281 var datas1,datas,lunarclmonth,inmonths;
283 for (var i=7;i<49;i++){
284 var realnumber = i - 7;
285 if (realnumber >= startfrom && j<= daysofthemonthyear){
286 var lunarcl = AmLich.getLunarDate(j,screen.curMonth,screen.curYear)
288 lunarclmonth = "/"+lunarcl.month
293 datas = j+"<br><span style='font-size:18px;float:right;color:#700070;'> "+lunarcl.day+lunarclmonth+"</span>";
295 monthclick = screen.curMonth;
296 yearclick = screen.curYear;
300 if (realnumber<startfrom){
301 datas1= prevmonth[realnumber];
304 datas1=nextmonth[(totalslot-realnumber)-1];
306 dayclick = datas1.duong;
307 monthclick = datas1.month;
308 yearclick = datas1.year;
309 datas = "<span style='color:grey;font-weight:normal;'>"+datas1.duong+"</span><br><span style='font-size:18px;float:right;color:#CCFFFF;'> "+datas1.am+"</span>";
313 lmodel.append({header:false,name:datas,inmonth:inmonths,day:dayclick,month:monthclick,year:yearclick})