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
20 import "amlich-hnd.js" as AmLich
27 anchors.fill: parent; anchors.bottomMargin: 0
34 width: grid.cellWidth; height: {
36 return grid.cellHeight - 15;
37 else return grid.cellHeight;
40 anchors.fill: parent;anchors.rightMargin: 2;anchors.topMargin: 2;
48 text: name; anchors.horizontalCenter: parent.horizontalCenter
49 font.pixelSize: 21;font.bold: true;font.family: "Tahoma"
58 if (day==initcurDay && month==initcurMonth && year==initcurYear)
61 return "lightsteelblue";
74 LC.reset(day,month,year)
75 screen.calculateLunar(day,month,year)
76 screen.state="mainscreen"
79 txtDATEpv.currentIndex = day-1;
85 parent.color="#F0F0F0"
91 if (day==initcurDay && month==initcurMonth && year==initcurYear)
92 parent.color="#00EBEB";
94 parent.color="lightsteelblue";
96 parent.color="#AAAAAA";
103 {if (day==initcurDay && month==initcurMonth && year==initcurYear) parent.color="#00EBEB"; else parent.color="lightsteelblue";}
105 parent.color="#AAAAAA";
127 anchors.horizontalCenterOffset: 15
128 anchors.bottomMargin: -52
129 anchors.topMargin: 42
130 anchors.horizontalCenter: parent.horizontalCenter
131 anchors.bottom: parent.bottom
132 anchors.top: parent.top
133 cellWidth: 110; cellHeight: 50
134 //Dung : 64 | Nam :110
136 delegate: contactDelegate
143 Component.onCompleted: {
148 for(var i=0;i<42;i++){
149 append({header:false,name:"",inmonths:false,day:0,month:0,year:0})
154 header:true;inmonth:false;day:0;month:0;year:0
159 header:true;inmonth:false;day:0;month:0;year:0
164 header:true;inmonth:false;day:0;month:0;year:0
168 header:true;inmonth:false;day:0;month:0;year:0
172 header:true;inmonth:false;day:0;month:0;year:0
176 header:true;inmonth:false;day:0;month:0;year:0
180 header:true;inmonth:false;day:0;month:0;year:0
185 Component.onCompleted: {
190 ToolBarSingle { id: toolBar; height: 50;
193 button1Label: "Quay Về"
196 screen.state="mainscreen"
201 Transition { NumberAnimation { properties: "x,y,opacity"; duration: 500; easing.type: Easing.InOutBack } }
210 height: screen.height
212 if (screen.width>=800)
221 function get_prevmonth(startfrom){
222 var cMonth=screen.curMonth;
223 var cYear=screen.curYear;
230 var daysofthemonthyear = LC.calDays(cMonth,cYear);
231 for (var i=daysofthemonthyear;i>daysofthemonthyear-startfrom;i--){
232 var lunarcl = AmLich.getLunarDate(i,cMonth,cYear)
233 pmonth.push({duong:i, am:lunarcl.day, month:cMonth, year:cYear})
235 return pmonth.reverse()
238 function get_nextmonth(startfrom){
239 var cMonth=screen.curMonth;
240 var cYear=screen.curYear;
248 for (var i=1;i<=startfrom;i++){
249 var lunarcl = AmLich.getLunarDate(i,cMonth,cYear)
250 pmonth.push({duong:i, am:lunarcl.day, month:cMonth, year:cYear});
252 return pmonth.reverse();
256 var firstdayofthemonthyear = AmLich.getLunarDate(1,screen.curMonth,screen.curYear).jd;
257 var startfrom = (firstdayofthemonthyear+1)%7;
258 var daysofthemonthyear = LC.calDays(screen.curMonth,screen.curYear);
263 var nextmonth = get_nextmonth(totalslot - (startfrom+daysofthemonthyear))
264 var prevmonth = get_prevmonth(startfrom)
266 var dayclick, monthclick, yearclick;
267 console.log(lmodel.count)
269 while(lmodel.count>7){
270 lmodel.remove(lmodel.count-1);
273 for (var i=7;i<49;i++){
274 var realnumber = i - 7;
275 if (realnumber >= startfrom && j<= daysofthemonthyear){
276 var lunarcl = AmLich.getLunarDate(j,screen.curMonth,screen.curYear)
278 var lunarclmonth = "/"+lunarcl.month
280 var lunarclmonth = ""
283 var datas = j+"<br><span style='font-size:18px;float:right;color:#700070;'> "+lunarcl.day+lunarclmonth+"</span>";
285 monthclick = screen.curMonth;
286 yearclick = screen.curYear;
290 if (realnumber<startfrom){
291 var datas1= prevmonth[realnumber];
294 var datas1=nextmonth[(totalslot-realnumber)-1];
296 dayclick = datas1.duong;
297 monthclick = datas1.month;
298 yearclick = datas1.year;
299 var datas = "<span style='color:grey;font-weight:normal;'>"+datas1.duong+"</span><br><span style='font-size:18px;float:right;color:#CCFFFF;'> "+datas1.am+"</span>";
303 lmodel.append({header:false,name:datas,inmonth:inmonths,day:dayclick,month:monthclick,year:yearclick})