web: borders to indicate day/month transitions
This commit is contained in:
		
							parent
							
								
									2320a1610b
								
							
						
					
					
						commit
						c7d1a8afaa
					
				@ -101,10 +101,13 @@ table.journalreport         { border-spacing: 0; }
 | 
				
			|||||||
.totalrule td               { border-top:thin solid black; }
 | 
					.totalrule td               { border-top:thin solid black; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
table.registerreport        { border-spacing:0; }
 | 
					table.registerreport        { border-spacing:0; }
 | 
				
			||||||
.registerreport tr          { vertical-align:top; }
 | 
					table.registerreport tr     { vertical-align:top; }
 | 
				
			||||||
.registerreport td          { padding-bottom:0.2em; }
 | 
					table.registerreport td     { padding-bottom:0.2em; }
 | 
				
			||||||
.registerreport .date       { white-space:nowrap; }
 | 
					table.registerreport .date  { white-space:nowrap; }
 | 
				
			||||||
.firstposting td            { }
 | 
					tr.firstposting td          { }
 | 
				
			||||||
 | 
					tr.newday td                { border-top: 1px solid black; }
 | 
				
			||||||
 | 
					tr.newmonth td              { border-top: 2px solid black; }
 | 
				
			||||||
 | 
					/* tr.newyear td               { border-top: 3px solid black; } */
 | 
				
			||||||
#accountsheading            { white-space:nowrap; margin-bottom:1em; }
 | 
					#accountsheading            { white-space:nowrap; margin-bottom:1em; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
<tr.item.#{inclass}
 | 
					<tr.item.#{inacctclass}
 | 
				
			||||||
 <td.account.#{depthclass}
 | 
					 <td.account.#{depthclass}
 | 
				
			||||||
  #{indent}
 | 
					  #{indent}
 | 
				
			||||||
  <a href="@?{accturl}">#{adisplay}
 | 
					  <a href="@?{accturl}">#{adisplay}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
<tr.item.#{evenodd}.#{firstposting}
 | 
					<tr.item.#{evenodd}.#{firstposting}.#{datetransition}
 | 
				
			||||||
 <td.date>#{date}
 | 
					 <td.date>#{date}
 | 
				
			||||||
 <td.description>#{desc}
 | 
					 <td.description>#{desc}
 | 
				
			||||||
 <td.account><a href="@?{accturl}">#{acct}
 | 
					 <td.account><a href="@?{accturl}">#{acct}
 | 
				
			||||||
 | 
				
			|||||||
@ -134,8 +134,9 @@ balanceReportAsHtml _ vd@VD{here=here,q=q,m=m,qopts=qopts,j=j} (items,total) = $
 | 
				
			|||||||
   itemAsHtml VD{here=here,q=q} (acct, adisplay, aindent, abal) = $(Settings.hamletFile "balancereportitem")
 | 
					   itemAsHtml VD{here=here,q=q} (acct, adisplay, aindent, abal) = $(Settings.hamletFile "balancereportitem")
 | 
				
			||||||
     where
 | 
					     where
 | 
				
			||||||
       depthclass = "depth"++show aindent
 | 
					       depthclass = "depth"++show aindent
 | 
				
			||||||
       inclass = case inacctmatcher of Just m -> if m `matchesAccount` acct then "inacct" else "notinacct"
 | 
					       inacctclass = case inacctmatcher of
 | 
				
			||||||
                                       Nothing -> "" :: String
 | 
					                       Just m -> if m `matchesAccount` acct then "inacct" else "notinacct"
 | 
				
			||||||
 | 
					                       Nothing -> "" :: String
 | 
				
			||||||
       indent = preEscapedString $ concat $ replicate (2 * aindent) " "
 | 
					       indent = preEscapedString $ concat $ replicate (2 * aindent) " "
 | 
				
			||||||
       accturl = (here, [("q", pack $ accountUrl acct)])
 | 
					       accturl = (here, [("q", pack $ accountUrl acct)])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -153,10 +154,14 @@ journalReportAsHtml _ vd items = $(Settings.hamletFile "journalreport")
 | 
				
			|||||||
registerReportAsHtml :: [Opt] -> ViewData -> RegisterReport -> Hamlet AppRoute
 | 
					registerReportAsHtml :: [Opt] -> ViewData -> RegisterReport -> Hamlet AppRoute
 | 
				
			||||||
registerReportAsHtml _ vd (balancelabel,items) = $(Settings.hamletFile "registerreport")
 | 
					registerReportAsHtml _ vd (balancelabel,items) = $(Settings.hamletFile "registerreport")
 | 
				
			||||||
 where
 | 
					 where
 | 
				
			||||||
   itemAsHtml :: ViewData -> (Int, RegisterReportItem) -> Hamlet AppRoute
 | 
					   itemAsHtml :: ViewData -> (Int, Bool, Bool, Bool, RegisterReportItem) -> Hamlet AppRoute
 | 
				
			||||||
   itemAsHtml VD{here=here} (n, (ds, posting, b)) = $(Settings.hamletFile "registerreportitem")
 | 
					   itemAsHtml VD{here=here} (n, newd, newm, newy, (ds, posting, b)) = $(Settings.hamletFile "registerreportitem")
 | 
				
			||||||
     where
 | 
					     where
 | 
				
			||||||
       evenodd = if even n then "even" else "odd" :: String
 | 
					       evenodd = if even n then "even" else "odd" :: String
 | 
				
			||||||
 | 
					       datetransition -- | newy && n > 1 = "newyear"
 | 
				
			||||||
 | 
					                      | newm = "newmonth"
 | 
				
			||||||
 | 
					                      | newd = "newday"
 | 
				
			||||||
 | 
					                      | otherwise = "" :: String
 | 
				
			||||||
       (firstposting, date, desc) = case ds of Just (da, de) -> ("firstposting", show da, de)
 | 
					       (firstposting, date, desc) = case ds of Just (da, de) -> ("firstposting", show da, de)
 | 
				
			||||||
                                               Nothing -> ("", "", "") :: (String,String,String)
 | 
					                                               Nothing -> ("", "", "") :: (String,String,String)
 | 
				
			||||||
       acct = paccount posting
 | 
					       acct = paccount posting
 | 
				
			||||||
@ -446,12 +451,20 @@ getMessageOr mnewmsg = do
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
numbered = zip [1..]
 | 
					numbered = zip [1..]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- Add incrementing transaction numbers to a list of register report items starting at 1.
 | 
					-- Add incrementing transaction numbers to a list of register report items
 | 
				
			||||||
numberTransactions :: [RegisterReportItem] -> [(Int,RegisterReportItem)]
 | 
					-- starting at 1.  Also add three flags that are true if the date, month,
 | 
				
			||||||
 | 
					-- and year is different from the previous item's.
 | 
				
			||||||
 | 
					numberTransactions :: [RegisterReportItem] -> [(Int,Bool,Bool,Bool,RegisterReportItem)]
 | 
				
			||||||
numberTransactions [] = []
 | 
					numberTransactions [] = []
 | 
				
			||||||
numberTransactions is = number 0 is
 | 
					numberTransactions is = number 0 nulldate is
 | 
				
			||||||
  where
 | 
					  where
 | 
				
			||||||
    number _ [] = []
 | 
					    number :: Int -> Day -> [RegisterReportItem] -> [(Int,Bool,Bool,Bool,RegisterReportItem)]
 | 
				
			||||||
    number n (i@(Just _, _, _):is)  = (n+1,i):(number (n+1) is)
 | 
					    number _ _ [] = []
 | 
				
			||||||
    number n (i@(Nothing, _, _):is) = (n,i):(number n is)
 | 
					    number n prevd (i@(Nothing, _, _)   :is)  = (n,False,False,False,i)    :(number n prevd is)
 | 
				
			||||||
 | 
					    number n prevd (i@(Just (d,_), _, _):is)  = (n+1,newday,newmonth,newyear,i):(number (n+1) d is)
 | 
				
			||||||
 | 
					        where
 | 
				
			||||||
 | 
					          newday = d/=prevd
 | 
				
			||||||
 | 
					          newmonth = dm/=prevdm || dy/=prevdy
 | 
				
			||||||
 | 
					          newyear = dy/=prevdy
 | 
				
			||||||
 | 
					          (dy,dm,_) = toGregorian d
 | 
				
			||||||
 | 
					          (prevdy,prevdm,_) = toGregorian prevd
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user