Tad, не надо пока на поголовье заострять внимание - там косяков куча надо понять как получить разницу между текущей датой и датой вывода через sqlite
------------ Дoбавленo в 23.32:
Add(MainForm,11607186,182,84) { Width=954 Height=598 Caption="график вакцинации" BorderStyle=4 Position=1 Point(doVisible) Point(onClose) link(onCreate,7309284:doEvent1,[]) } Add(MTStrTbl,15761846,882,644) { @Color=5592575 Left=285 Top=45 Width=570 Height=215 Name="график" Columns=#6:корпус|4:дата|9:поголовье|0:|0:|0:|0:|0:|0:|0:|0:|0:|0:|0:|0:|0:|0:|0:|0:|0:|0:|0:|0:|0:|0:|0:|0:| TextAlign=2 Point(doVisible) } Add(Button,949453,56,602) { Left=420 Top=15 Width=135 TabOrder=-1 Caption="рассчитать" link(onClick,11771530:doString,[]) } Add(ComboBox,11406695,126,539) { Left=300 Top=15 Width=110 Height=21 Strings=#8:корпус 1|8:корпус 2|8:корпус 3|8:корпус 4|8:корпус 5| Text="корпус" Point(EditText) } Add(MTStrTbl,5113738,553,371) { @Color=43520 Left=20 Top=115 Width=250 Height=155 Name="вакцинация" Columns=#14:ВАКЦИНАЦИЯ=150|17:ВОЗРАСТ (ДНИ)=100| Redaction=0 Point(doSetFocus) Point(onSelect) Point(doVisible) } Add(Edit,16767801,161,308) { Left=101 Top=45 Width=110 Text="0" DataType=2 } Add(Button,12084787,42,371) { Left=15 Top=70 Width=195 Height=30 TabOrder=-1 Caption="добавить" Point(doSetFocus) link(onClick,6806148:doEvent2,[]) } Add(ComboBox,4864849,119,308) { Left=95 Top=10 Width=125 Height=21 Strings=#2:БМ|2:БГ|2:БН|3:ИБК|3:ИЛТ| Text="вакцинацияя" Point(EditText) } Add(DatePicker,9450650,168,455) { Left=565 Top=15 Width=110 Height=21 Font=[MS Sans Serif,6,0,0,1] Point(doLeft) Point(doTop) Point(doSetFocus) Point(doBringToFront) Point(DateTime) Point(doSendToBack) Point(CurrentDateTime) link(onChange,13250376:doEvent1,[]) } Add(DS_SQLite,6991059,364,105) { @Color=5636095 Name="11" FileName="memory.db" Point(onError) link(onOpen,13846613:doExec,[(404,111)(404,90)]) link(onError,7054140:doEvent2,[]) } Add(Message,3808633,497,105) { } Add(DSC_Exec,13846613,406,84) { @Color=5636095 SQL="CREATE TABLE IF NOT EXISTS [vakcina] (\r\n[id] INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\r\n[name] TEXT,\r\n[number] INTEGER);\r\n\r\nCREATE TABLE IF NOT EXISTS [grafikdata] (\r\n[id] INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\r\n[name] TEXT,\r\n[vozrast] REAL,\r\n[golov] REAL,\r\n[dtime] REAL);\r\n\r\nCREATE TABLE IF NOT EXISTS [grafikname] (\r\n[id] INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\r\n[name] TEXT,\r\n[golov1] TEXT,\r\n[ups] TEXT);" DSManager="11" link(onError,7054140:doEvent1,[(450,97)(450,111)]) } Add(DSC_Exec,7884957,301,357) { @Color=5636095 DSManager="11" link(onExec,15277953:doEvent1,[]) link(onError,14022728:doWork,[(338,370)(338,377)]) } Add(FormatStr,8126504,154,364) { Mask="INSERT INTO [vakcina] ([name], [number]) VALUES('%1', %2); " link(onFString,15049159:doEvent2,[]) link(Str1,4864849:String,[(160,359)(132,359)]) link(Str2,16767801:Text,[]) } Add(MST_DB,953009,511,371) { @Color=43520 MSTControl="вакцинация" Point(doClear) } Add(Hub,15277953,364,357) { link(onEvent1,13439786:doEvent1,[(472,363)(472,391)]) link(onEvent2,11511635:doQuery,[(385,370)(385,377)]) } Add(DSC_Query,11511635,392,371) { @Color=5636095 SQL="SELECT [name], [number] from [vakcina]" DSManager="11" link(onQuery,953009:doAddRow,[]) link(onError,12129855:doWork,[]) } Add(LineBreakEx,14022728,343,371) { } Add(LineBreakEx,8042414,420,119) { Type=1 link(OnEvent,7054140:doEvent3,[]) } Add(LineBreakEx,12129855,434,385) { Caption="1" } Add(DSC_Exec,12182020,287,595) { @Color=5636095 DSManager="11" link(onExec,10771421:doEvent1,[]) link(onError,3606489:doWork,[(324,608)(324,615)]) } Add(FormatStr,11771530,147,602) { DataCount=4 Mask="INSERT INTO [grafikdata] ([name], [vozrast], [golov], [dtime]) VALUES('%1', '%2', %3, %4); \r\nINSERT INTO [grafikname] ([name], [golov1], [ups]) VALUES('%1', %2, '%3'); " link(onFString,14909773:doEvent2,[(190,608)(190,636)]) link(Str1,11406695:String,[(153,593)(139,593)]) link(Str2,269458:Text,[(160,590)(216,590)]) link(Str3,15451964:Text,[(167,586)(265,586)]) link(Str4,16251723:Data1,[]) } Add(MST_DB,10553212,882,602) { @Color=5592575 MSTControl="график" Point(doClearAll) Point(doClear) } Add(LineBreakEx,3606489,329,609) { } Add(Hub,10771421,350,595) { OutCount=5 link(onEvent1,2288361:doEvent2,[(379,601)(379,581)]) link(onEvent2,15451509:doData,[]) link(onEvent3,12922371:doQuery,[(394,615)(394,640)(623,640)(623,622)]) link(onEvent4,4614904:doQuery,[(378,622)(378,664)]) } Add(DSC_Query,4614904,385,658) { @Color=5636095 SQL="SELECT [name], [vozrast], [golov], strftime("%d.%m.%Y", 1721424.5 + [dtime]), [dtime] from [grafikdata]" DSManager="11" link(onQuery,13313127:doEvent1,[]) link(onError,3923348:doWork,[]) } Add(LineBreakEx,3923348,434,672) { } Add(DSC_Query,12922371,630,616) { @Color=5636095 SQL="SELECT [name] from [vakcina]" DSManager="11" link(onQuery,9772768:doWork2,[(668,622)(668,615)]) link(onError,4829472:doWork,[]) } Add(LineBreakEx,4829472,679,630) { } Add(DoData,15451509,406,602) { Data=String(корпус) link(onEventData,3754311:doAdd,[]) } Add(MT_Add,3754311,448,602) { Data=String(поголовье) link(onAdd,10823801:doAdd,[]) } Add(HubEx,9772768,672,609) { link(onEvent,10498153:doEvent1,[]) } Add(FormatStr,8156537,595,707) { DataCount=1 Mask="SELECT strftime("%d.%m.%Y", 1721424.5 + %1 + [number]) from [vakcina]" link(onFString,11422646:doQuery,[]) link(Str1,15251959:Value5,[]) } Add(DSC_Query,11422646,637,707) { @Color=5636095 DSManager="11" link(onQuery,10214565:doAdd,[]) link(onError,6059374:doWork,[]) } Add(LineBreakEx,6059374,679,721) { } Add(MT_MultiMem,15251959,567,658) { Count=5 } Add(Hub,13313127,455,658) { OutCount=6 link(onEvent1,15251959:doValue,[]) link(onEvent2,8156537:doString,[(557,671)(557,713)]) link(onEvent3,10341187:doAdd,[(550,678)(550,867)]) link(onEvent4,4303723:doClear,[(644,685)(644,720)]) link(onEvent5,1254444:doString,[(549,692)(549,797)]) } Add(MT_Memory,4303723,756,707) { } Add(MT_Add,10214565,700,707) { InputMT=1 link(onAdd,4303723:doValue,[]) link(Data,15937933:Var3,[(706,691)(748,691)]) } Add(MT_AddData,10341187,567,861) { Count=5 link(onAdd,10553212:doAddRow,[(795,867)(795,608)]) link(Data1,15251959:Value1,[]) link(Data2,15251959:Value2,[]) link(Data3,16539517:Var2,[(587,848)(776,848)]) link(Data4,15251959:Value4,[]) link(Data5,15937933:Var1,[(601,747)]) } Add(GetDataEx,15937933,742,742) { Angle=1 link(Data,4303723:Value,[(762,747)]) } Add(Label,2084213,119,266) { Left=15 Top=15 Width=64 Height=17 Caption="вакцинация" } Add(Label,6975909,161,266) { Left=15 Top=45 Width=78 Height=17 Caption="возраст (дней)" } Add(Button,8086717,133,42) { Left=865 Top=80 Width=65 Height=25 Hint="Сворачивает в трей" Caption="Свернуть" link(onClick,3126296:doEvent1,[]) } Add(TrayIcon,6079368,294,35) { Hint="софтинка" FormHook=0 ShowWORemoveIcon=0 Text="двойной клик - развернуть" link(onDblClick,11103182:doCase,[]) } Add(Case,11103182,336,42) { Value=Integer(0) link(onTrue,7275996:doEvent1,[]) } Add(Hub,3126296,266,42) { InCount=2 OutCount=1 link(onEvent1,6079368:doHide,[]) } Add(ChanelToIndex,12581794,441,49) { link(onIndex,11607186:doVisible,[(480,55)(480,21)(109,21)(109,118)]) } Add(Hub,7275996,378,49) { link(onEvent1,6079368:doShow,[(397,55)(397,27)(289,27)(289,41)]) link(onEvent2,12581794:doWork2,[]) } Add(Hub,7309284,231,98) { OutCount=8 link(onEvent1,3126296:doEvent2,[(259,104)(259,55)]) link(onEvent2,6991059:doOpen,[]) link(onEvent3,922736:doMTString,[(271,118)(271,139)]) link(onEvent4,6668430:In,[(266,125)(266,167)]) link(onEvent5,8909681:In,[(259,132)(259,181)]) link(onEvent8,12328708:doMTString,[(263,153)(263,216)]) } Add(Button,9281433,133,77) { Left=865 Top=50 Width=65 Height=25 Caption="Закрыть" link(onClick,11607186:doClose,[(170,83)(170,111)]) } Add(MT_String,922736,280,119) { link(onResult,2904434:doRowAction,[]) } Add(MST_RowAction,2904434,322,119) { @Color=5592575 MSTControl="график" } Add(Hub,7054140,462,105) { InCount=3 link(onEvent1,3808633:doMessage,[]) } Add(Button,4038752,392,462) { Left=20 Top=310 Width=195 Height=35 Caption="очистить" link(onClick,13172925:doEvent1,[]) } Add(DSC_Exec,16152874,497,469) { @Color=5636095 SQL="delete from vakcina;\r\ndelete from grafikdata;\r\ndelete from grafikname;" DSManager="11" } Add(Hub,13172925,455,462) { OutCount=3 link(onEvent1,13439786:doEvent2,[(480,468)(480,398)]) link(onEvent2,16152874:doExec,[]) link(onEvent3,2288361:doEvent1,[(476,482)(476,574)]) } Add(Hub,2288361,490,568) { InCount=2 link(onEvent1,10553212:doClearAll,[(693,574)(693,622)]) } Add(Hub,13439786,483,385) { InCount=2 OutCount=1 link(onEvent1,953009:doClear,[]) } Add(Hub,14909773,259,623) { InCount=2 link(onEvent1,12182020:doExec,[(280,629)(280,601)]) } Add(LineBreak,14019031,203,616) { Caption="база1" link(Out,14909773:doEvent1,[(253,622)(253,629)]) Primary=[6668430,77,-455] } Add(LineBreak,432956,210,350) { Caption="база 2" link(Out,15049159:doEvent1,[(265,356)(265,363)]) Primary=[8909681,70,-175] } Add(Hub,15049159,273,357) { InCount=2 link(onEvent1,7884957:doExec,[]) } Add(MT_String,12328708,280,196) { link(onResult,7998381:doRowAction,[]) } Add(MST_RowAction,7998381,322,196) { @Color=22015 MSTControl="график2" } Add(Hub,10498153,763,609) { link(onEvent1,10553212:doAddCols,[]) } Add(InfoTip,7056213,371,441) { Info=#13:очистить базу| Font=[MS Sans Serif,9,1,0,1] Width=190 Height=102 } Add(GetData,16251723,168,546) { Count=4 link(Data,11168039:Var2,[]) } Add(Hub,13250376,217,455) { OutCount=3 link(onEvent1,15645073:doCalc,[(243,461)(243,657)(191,657)(191,853)]) } Add(Hub,6806148,91,364) { InCount=2 OutCount=1 link(onEvent1,8126504:doString,[]) } Add(MT_Add,10823801,490,602) { Data=String(возраст) link(onAdd,13615503:doAdd,[(529,608)(529,608)]) } Add(Edit,269458,210,546) { Left=685 Top=15 Text="100" DataType=2 } Add(Edit,15451964,259,539) { Left=745 Top=16 Text="1" DataType=2 } Add(MT_Add,13615503,536,602) { Data=String(вывод) link(onAdd,9772768:doWork1,[(676,608)]) } Add(DateDiff,15645073,203,847) { link(onCalc,1509445:doSeparateMT,[]) link(DateTime1,9450650:CurrentDateTime,[(209,673)(181,673)]) link(DateTime2,11168039:Var3,[(216,523)]) } Add(GetDataEx,11168039,168,518) { link(Data,9450650:DateTime,[]) } Add(MT_MultiData,1509445,266,847) { link(onData2,15451964:doText,[(310,860)(310,702)(247,702)(247,545)]) } Add(FormatStr,1254444,630,791) { DataCount=1 Mask="SELECT (date('now')- date(dtime)) FROM [grafikdata]" link(onFString,56683:doQuery,[]) link(Str1,15251959:Value3,[(636,741)(587,741)]) } Add(DSC_Query,56683,672,791) { @Color=5636095 DSManager="11" link(onQuery,6545168:doAdd,[]) link(onError,9070171:doWork,[]) } Add(LineBreakEx,9070171,714,805) { } Add(MT_Memory,5732491,791,791) { } Add(MT_Add,6545168,735,791) { InputMT=1 link(onAdd,5732491:doValue,[]) link(Data,16539517:Var1,[(741,779)(767,779)(767,831)]) } Add(GetDataEx,7432591,791,826) { link(Data,5732491:Value,[]) } Add(GetDataEx,16539517,770,826) { Angle=1 link(Data,7432591:Var1,[]) }
прописал SELECT (date('now')- date(dtime)) FROM [grafikdata] ерунда получилась
------------ Дoбавленo в 00.13:
Tad, вот сделал пример по вычислению дат Add(MainForm,11607186,168,126) { Width=954 Height=721 Caption="график вакцинации" BorderStyle=4 Position=1 Point(doVisible) Point(onClose) link(onCreate,7309284:doEvent1,[]) } Add(MTStrTbl,15761846,868,686) { @Color=5592575 Left=280 Top=50 Width=570 Height=215 Name="график" Columns=#6:корпус|4:дата|9:поголовье|0:|0:|0:|0:|0:|0:|0:|0:|0:|0:|0:|0:|0:|0:|0:|0:|0:|0:|0:|0:|0:|0:|0:|0:| TextAlign=2 Point(doVisible) } Add(Button,949453,42,644) { Left=185 Top=20 Width=135 TabOrder=-1 Caption="рассчитать" link(onClick,11771530:doString,[]) } Add(ComboBox,11406695,112,581) { Left=40 Top=20 Width=110 Height=21 Strings=#8:корпус 1|8:корпус 2|8:корпус 3|8:корпус 4|8:корпус 5| Text="корпус" Point(EditText) } Add(DatePicker,9450650,154,420) { Left=345 Top=25 Width=110 Height=21 Font=[MS Sans Serif,6,0,0,1] Point(doLeft) Point(doTop) Point(doSetFocus) Point(doBringToFront) Point(DateTime) Point(doSendToBack) link(onChange,6784755:doConvert,[(198,426)(198,461)(128,461)(128,496)]) } Add(DS_SQLite,6991059,350,147) { @Color=5636095 Name="11" FileName="5me8mory.db" Point(onError) link(onOpen,13846613:doExec,[(390,153)(390,132)]) link(onError,7054140:doEvent2,[]) } Add(Message,3808633,483,147) { } Add(DSC_Exec,13846613,392,126) { @Color=5636095 SQL="CREATE TABLE IF NOT EXISTS [grafikdata] (\r\n[id] INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\r\n[name] TEXT,\r\n[dates] REAL,\r\n[datem] REAL,\r\n[result] REAL );" DSManager="11" link(onError,7054140:doEvent1,[(436,139)(436,153)]) } Add(LineBreakEx,8042414,406,161) { Type=1 link(OnEvent,7054140:doEvent3,[]) } Add(DSC_Exec,12182020,273,637) { @Color=5636095 DSManager="11" link(onExec,10771421:doEvent1,[]) link(onError,3606489:doWork,[(310,650)(310,657)]) } Add(FormatStr,11771530,133,644) { DataCount=4 Mask="INSERT INTO [grafikdata] ([name], [dates], [datem], [result]) VALUES('%1', '%2', '%3', '%4'); " link(onFString,14909773:doEvent2,[(176,650)(176,678)]) link(Str1,11406695:String,[(139,635)(125,635)]) link(Str2,11881922:Value,[(146,586)(202,586)]) link(Str3,6626224:Value,[(153,586)(356,586)]) } Add(MST_DB,10553212,868,644) { @Color=5592575 MSTControl="график" Point(doClearAll) Point(doClear) } Add(LineBreakEx,3606489,315,651) { } Add(Hub,10771421,336,637) { OutCount=5 link(onEvent1,2288361:doEvent2,[(365,643)(365,623)]) link(onEvent2,15451509:doData,[]) link(onEvent4,4614904:doQuery,[(364,664)(364,706)]) } Add(DSC_Query,4614904,371,700) { @Color=5636095 SQL="SELECT [name], [dates], [datem], [result] from [grafikdata]" DSManager="11" link(onQuery,13313127:doEvent1,[]) link(onError,3923348:doWork,[]) } Add(LineBreakEx,3923348,420,714) { } Add(LineBreakEx,4829472,665,672) { } Add(DoData,15451509,392,644) { Data=String(корпус) link(onEventData,3754311:doAdd,[]) } Add(MT_Add,3754311,434,644) { Data=String(поголовье) link(onAdd,10823801:doAdd,[]) } Add(HubEx,9772768,658,651) { link(onEvent,10498153:doEvent1,[]) } Add(MT_MultiMem,15251959,553,700) { Count=5 } Add(Hub,13313127,441,700) { OutCount=6 link(onEvent1,15251959:doValue,[]) link(onEvent2,10341187:doAdd,[(504,713)(504,909)]) link(onEvent3,1254444:doString,[(525,720)(525,790)]) } Add(MT_AddData,10341187,553,903) { Count=5 link(onAdd,10553212:doAddRow,[(781,909)(781,650)]) link(Data1,15251959:Value1,[]) link(Data2,15251959:Value2,[]) link(Data3,15251959:Value3,[]) link(Data4,3912048:Var2,[(580,859)(762,859)]) } Add(Hub,7309284,217,140) { OutCount=8 link(onEvent2,6991059:doOpen,[]) link(onEvent3,922736:doMTString,[(257,160)(257,181)]) link(onEvent4,6668430:In,[(252,167)(252,209)]) } Add(MT_String,922736,266,161) { link(onResult,2904434:doRowAction,[]) } Add(MST_RowAction,2904434,308,161) { @Color=5592575 MSTControl="график" } Add(Hub,7054140,448,147) { InCount=3 link(onEvent1,3808633:doMessage,[]) } Add(Hub,2288361,476,610) { InCount=2 link(onEvent1,10553212:doClearAll,[(679,616)(679,664)]) } Add(Hub,14909773,245,665) { InCount=2 link(onEvent1,12182020:doExec,[(266,671)(266,643)]) } Add(LineBreak,16026948,189,658) { Caption="база1" link(Out,14909773:doEvent1,[(239,664)(239,671)]) Primary=[6668430,77,-455] } Add(Hub,10498153,749,651) { link(onEvent1,10553212:doAddCols,[]) } Add(MT_Add,10823801,476,644) { Data=String(возраст) link(onAdd,13615503:doAdd,[]) } Add(MT_Add,13615503,522,644) { Data=String(вывод) link(onAdd,9772768:doWork1,[(662,650)]) } Add(GetDataEx,8895160,777,872) { Angle=1 } Add(DatePicker,15543175,266,420) { Left=490 Top=10 Width=160 Height=21 Point(DateTime) link(onChange,3994705:doConvert,[(310,426)(310,461)(282,461)(282,496)]) } Add(DateConvertor,6784755,140,490) { Mode=9 Format="dd.MM.yyyy" Point(Data) link(onResult,11881922:doValue,[(184,496)(184,503)]) link(Data,9450650:DateTime,[(146,478)(160,478)]) } Add(Memory,11881922,196,497) { } Add(DateConvertor,3994705,294,490) { Mode=9 Format="dd.MM.yyyy" Point(Data) link(onResult,6626224:doValue,[(338,496)(338,503)]) link(Data,15543175:DateTime,[(300,471)(272,471)]) } Add(Memory,6626224,350,497) { } Add(FormatStr,1254444,595,784) { DataCount=1 Mask="SELECT (date(dates) - date(datem)) FROM [grafikdata]" link(onFString,56683:doQuery,[]) link(Str1,15251959:Value4,[(601,758)(580,758)]) } Add(DSC_Query,56683,637,784) { @Color=5636095 DSManager="11" link(onQuery,6545168:doAdd,[]) link(onError,9070171:doWork,[]) } Add(LineBreakEx,9070171,679,798) { } Add(MT_Memory,5732491,756,784) { } Add(MT_Add,6545168,700,784) { InputMT=1 link(onAdd,5732491:doValue,[]) link(Data,3912048:Var1,[(706,772)(732,772)(732,831)]) } Add(GetDataEx,3912048,756,826) { link(Data,5732491:Value,[]) }
но разница между dates и datem не происходит
|