Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 4ec81d44

Von Marei Peischl vor mehr als 3 Jahren hinzugefügt

  • ID 4ec81d4495b09cc218a3237ebc1548be44309c7e
  • Vorgänger 1057b87c
  • Nachfolger 3d229eb9

marei: add basic structure to color tables

Unterschiede anzeigen:

templates/print/marei/kiviletter.sty
160 160

  
161 161
\dim_new:N \g_kivi_tabcolsep_dim
162 162
\dim_gset:Nn \g_kivi_tabcolsep_dim {.5\tabcolsep}
163
\setlength\tabcolsep{.5\tabcolsep}
163 164

  
164 165
\prg_new_conditional:Nnn \kivi_if_Price_col:n {T} {
165 166
	\prop_get:cnN {l_kivi_col_#1_prop} {colspec} \l_tmpa_tl
......
170 171

  
171 172

  
172 173
\cs_new:Nn \__kivi_calc_desc_column: {
173
	\dim_zero:N \l_kivi_tab_desc_leftskip_dim
174
	\bool_if:NTF \g__kivi_Tabular_rowcolor_bool
175
		{\dim_set:Nn \l_kivi_tab_desc_leftskip_dim {2\g_kivi_tabcolsep_dim}}
176
		{\dim_zero:N \l_kivi_tab_desc_leftskip_dim}
174 177
	\dim_zero:N \l_kivi_tab_desc_dim
175 178
	\bool_set_false:N \l_tmpa_bool
176 179
	\tl_gclear:N \g_kivi_Pricing_colspec_tl
......
197 200
			}
198 201
		}
199 202
	}
200
	\tl_gput_left:Nn \g_kivi_Pricing_colspec_tl {@{}}
201
	\tl_gput_right:Nn \g_kivi_Pricing_colspec_tl {@{}}
203
	\bool_if:NF \g__kivi_Tabular_rowcolor_bool {
204
		\tl_gput_left:Nn \g_kivi_Pricing_colspec_tl {@{}}
205
		\tl_gput_right:Nn \g_kivi_Pricing_colspec_tl {@{}}
206
	}
202 207
}
203 208

  
204 209
\newcolumntype{K}[1]{>{\raggedleft\arraybackslash}p{#1}}
......
249 254
\seq_new:N \l_kivi_PricingTable_seq
250 255
\seq_new:N \l_kivi_columns_seq
251 256
\seq_new:N \g_kivi_extraDescription_seq
257

  
258
\int_new:N \l__kivi_PricingTable_rowcolor_int
252 259
\dim_new:N \l__kivi_fboxsep_dim 
253 260
\dim_set:Nn \l__kivi_fboxsep_dim {\g_kivi_tabcolsep_dim}
254 261

  
......
292 299
	\let\ExtraDescription\__kivi_addExtraDescription:n
293 300
	\setlength{\tabcolsep}{\g_kivi_tabcolsep_dim}
294 301
	\seq_map_inline:Nn \l_kivi_PricingTable_seq {
302
		\bool_if:NT \g__kivi_Tabular_rowcolor_bool {
303
			\int_gincr:N \g__kivi_PricingTable_rowcolor_int 
304
			\int_if_odd:nTF {\g__kivi_PricingTable_rowcolor_int}
305
			{\nointerlineskip\kivi@tabcolorbox{\g__kivi_Tabular_rowcolor_odd_tl}}
306
			{\nointerlineskip\kivi@tabcolorbox{\g__kivi_Tabular_rowcolor_even_tl}}
307
		}
308
		{\parbox{\linewidth}{
295 309
		\seq_set_split:Nnn  \l_kivi_columns_seq {&} {##1}
296 310
	\seq_gclear:N \g_kivi_extraDescription_seq
297 311
	\exp_args:Nnx \use:n {\tabular[t]}\g_kivi_Pricing_colspec_tl
......
305 319
	{\par}
306 320
	{\par\nopagebreak
307 321
	\begingroup
308
	\setlength{\hsize}{\dimexpr\l_kivi_tab_desc_dim+\l_kivi_tab_desc_leftskip_dim}
309
	\setlength{\leftskip}{\l_kivi_tab_desc_leftskip_dim}
322
	\setlength{\leftskip}{\dim_eval:n {\bool_if:NT \g__kivi_Tabular_rowcolor_bool {-\tabcolsep} +\l_kivi_tab_desc_leftskip_dim}}
323
	\setlength{\hsize}{\dim_eval:n {\l_kivi_tab_desc_dim+\leftskip}}
310 324
	\usekomafont{extraDescription}
311 325
	\seq_use:Nn \g_kivi_extraDescription_seq {\\}
312 326
	\par
313 327
	\endgroup
314 328
	}
329
	}}
315 330
	}
316
	\endgroup
331
	\endgroup\par
317 332
}
318 333

  
319 334

  
......
329 344

  
330 345
\tl_new:N \g_kivi_Pricing_colspec_tl
331 346
\tl_gset:Nn \g_kivi_Pricing_colspec_tl {
332
	@{}
347
	\bool_if:NF \g__kivi_Tabular_rowcolor_bool {@{}}
333 348
	\bool_if:NT \l_kivi_col_pos_bool {p{\l_kivi_tab_pos_dim}}
334 349
	\bool_if:NT \l_kivi_col_id_bool {p{\l_kivi_tab_id_dim}}
335 350
	p{\l_kivi_tab_desc_dim}
336 351
	\bool_if:NT \l_kivi_col_amount_bool {\exp_not:n {>{\raggedleft\arraybackslash}p{\l_kivi_tab_amount_dim}}}
337 352
	\bool_if:NT \l_kivi_col_price_bool {\exp_not:n {>{\raggedleft\arraybackslash}p{\l_kivi_tab_price_dim}<{\__kivi_tab_column_currency:}}}
338 353
	\bool_if:NT \l_kivi_col_pricetotal_bool {\exp_not:n {>{\raggedleft\arraybackslash}p{\l_kivi_tab_pricetotal_dim}<{\__kivi_tab_column_currency:}}}
339
	@{}
354
	\bool_if:NF \g__kivi_Tabular_rowcolor_bool {@{}}
340 355
}
341 356

  
342 357
\cs_new_protected:Nn \__kivi_tab_column_currency: {\,\currency}
......
351 366
\newkomafont{PricingTableHeader}{\bfseries}
352 367

  
353 368
\cs_new:Nn \__kivi_setup_LT_boxes: {
369
%	\bool_show:N  \g__kivi_Tabular_rowcolor_bool
354 370
	\__kivi_calc_desc_column:
355 371
	\hbox_gset:Nn \g_kivi_LT@head_box {
356 372
		\setlength{\tabcolsep}{\g_kivi_tabcolsep_dim}
373
		\bool_if:NT \g__kivi_Tabular_rowcolor_bool {\kivi@tabcolorbox{\g__kivi_Tabular_rowcolor_header_tl}}%
374
		{
357 375
		\exp_args:Nnx \use:n {\tabular[b]}\g_kivi_Pricing_colspec_tl
358 376
		\__kivi_PricingTabular_header:
359 377
		\endtabular
378
		}
360 379
	}
361 380
	\hbox_gset:Nn \g_kivi_LT@foot_box {
362
		\raisebox{\depth}{
363
			\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}r@{}}
381
%		\parbox{\linewidth}{
382
%		\leavevmode\color{red}\rule{\linewidth}{1pt}\par\nointerlineskip
383
%		\leavevmode\color{blue}\rule{\linewidth}{1cm}
384
%		}
385
%		\raisebox{\depth}{
386
			\begin{tabular*}{\textwidth}[t]{@{\extracolsep{\fill}}r@{\bool_if:NT \g__kivi_Tabular_rowcolor_bool {\hskip\tabcolsep}}}
387
				\bool_if:NTF \g__kivi_Tabular_rowcolor_bool
388
				{\hline\noalign{\vskip1pt}}%\noalign{\nointerlineskip\vskip\z@}\noalign{\nointerlineskip\rule{\linewidth}{\arrayrulewidth}}}%\leavevmode\rule{\linewidth}{\arrayrulewidth}}} 
364 389
				\midrule
365 390
				\strut\weiteraufnaechsterseite
366 391
			\end{tabular*}
367
		}
392
%		}
368 393
	}
369 394
	\hbox_gset:Nn \g_kivi_LT@lastfoot_box {
370 395
		\raisebox{\dimexpr\depth+\baselineskip}[0pt][0pt]{
371
			\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}r@{}}
372
				\bottomrule
396
			\begin{tabular*}{\textwidth}{@{\bool_if:NT \g__kivi_Tabular_rowcolor_bool {\hskip\tabcolsep}\extracolsep{\fill}}r@{\bool_if:NT \g__kivi_Tabular_rowcolor_bool {\hskip\tabcolsep}}}
397
			\bool_if:NF \g__kivi_Tabular_rowcolor_bool \bottomrule
373 398
			\end{tabular*}
374 399
		}
375 400
	}
......
377 402

  
378 403

  
379 404
%Macht es sinn hier eine Variante zu machen, in der alle Spalten Belegbar sind?
380
\newenvironment{PricingTotal}{
405
\NewDocumentEnvironment{PricingTotal}{+b}{
381 406
	\par\nointerlineskip
382
	\unskip
383
	\tabular[t]{@{}p{\dim_eval:n {\linewidth-\l_kivi_tab_pricetotal_dim-2\tabcolsep}}P{\l_kivi_tab_pricetotal_dim}@{}}
384
	\midrule
407
%	\unskip
385 408
}{
409
	\bool_if:NT \g__kivi_Tabular_rowcolor_bool 	{\nointerlineskip\kivi@tabcolorbox{\g__kivi_Tabular_rowcolor_PricingTotal_tl}}
410
	{	
411
	\tabular[t]{@{\bool_if:NT \g__kivi_Tabular_rowcolor_bool {\hskip\tabcolsep}}
412
	p{\dim_eval:n {\linewidth-\l_kivi_tab_pricetotal_dim-\bool_if:NTF \g__kivi_Tabular_rowcolor_bool {4}{2}\tabcolsep}}P{\l_kivi_tab_pricetotal_dim}@{\bool_if:NT \g__kivi_Tabular_rowcolor_bool {\hskip\tabcolsep}}}
413
	\l__kivi_Tabular_PricingTotal_topsep_tl
414
	#1
386 415
	\endtabular
416
	}
387 417
}
388 418

  
419
\tl_new:N \l__kivi_Tabular_PricingTotal_topsep_tl
420
%TODO
421
\tl_set:Nn \l__kivi_Tabular_PricingTotal_topsep_tl {\bool_if:NF \g__kivi_Tabular_rowcolor_bool \midrule}
389 422

  
390 423
\newcommand*\ExtraDescription{
391 424
	\PackageError{kiviletter}{The~command~\string\ExtraDescription\space~may~be~only~used~inside~the~\string\FakeTable\space~environment.}{See~documentation~for~details}
......
407 440
	\midrule
408 441
	\rlap{\makebox[\textwidth][r]{\weiteraufnaechsterseite}}\\
409 442
	\endfoot
410
	\bottomrule
443
	\bool_if:NF \g__kivi_Tabular_rowcolor_bool \bottomrule
411 444
	\endlastfoot
412 445
}{
413 446
	\endlongtable
......
415 448
}
416 449

  
417 450
\cs_set:Nn \__kivi_PricingTabular_header: {
418
	\toprule
451
	\bool_if:NTF \g__kivi_Tabular_rowcolor_bool {\noalign{\skip_vertical:n {\dp\strutbox}}}\toprule
419 452
	\cs_gset_eq:NN \__kivi_tab_column_currency: \__kivi_tab_column_header_currency:
420 453
	\bool_set_false:N \l_tmpa_bool
421 454
	\clist_map_inline:Nn \g_kivi_pricingtable_col_clist	{
......
428 461
	}
429 462
	\cs_gset_eq:NN \__kivi_tab_column_currency: \__kivi_tab_column_body_currency:
430 463
	\\
431
	\midrule
464
	\bool_if:NF \g__kivi_Tabular_rowcolor_bool \midrule
432 465
}
433 466

  
467
\newkomafont{tablehead}{\bfseries}
434 468

  
435 469
\keys_define:nn {kivi/SimpleTabular} {
436 470
	colspec .tl_set:N =\l_kivi_SimpleTabular_colspec_tl,
437 471
	colspec .initial:n = {rrX},
438 472
	headline .tl_set:N = \l_kivi_SimpleTabular_headline_tl,
439
	headline .initial:n = {\bfseries\position & \bfseries\menge & \bfseries\bezeichnung},
473
	headline .initial:n = {\usekomafont{tablehead}\position & \usekomafont{tablehead}\menge & \usekomafont{tablehead}\bezeichnung},
474
}
475

  
440 476
\keys_define:nn {kivi/Tabular} {
441 477
	color-rows .bool_gset:N =  \g__kivi_Tabular_rowcolor_bool ,
442 478
	color-rows .initial:n = false,
......
461 497
	\tl_if_in:nnTF {#1} {=} {\keys_set:nn {kivi/SimpleTabular} {#1}} {\tl_if_empty:nF {#1} {\tl_set:Nn \l_kivi_SimpleTabular_headline_tl {#1}}}
462 498
	\setlength{\tabcolsep}{\g_kivi_tabcolsep_dim}
463 499
	\dim_set:Nn \parskip {\c_zero_dim}
464
	\tl_put_right:Nn \l_kivi_SimpleTabular_colspec_tl {@{}}
465
	\tl_put_left:Nn \l_kivi_SimpleTabular_colspec_tl {@{}}
500
	\bool_if:NF	\g__kivi_Tabular_rowcolor_bool {
501
		\tl_put_right:Nn \l_kivi_SimpleTabular_colspec_tl {@{}}
502
		\tl_put_left:Nn \l_kivi_SimpleTabular_colspec_tl {@{}}
503
	}
466 504
	\exp_args:NnV \xltabular{\linewidth}\l_kivi_SimpleTabular_colspec_tl
467 505
		\toprule
468 506
		\cs_gset_eq:NN \__kivi_tab_column_currency: \__kivi_tab_column_header_currency:
......
474 512
		\midrule
475 513
		\rlap{\makebox[\textwidth][r]{\weiteraufnaechsterseite}}\\
476 514
	\endfoot
477
		\bottomrule
515
	\bool_if:NF \g__kivi_Tabular_rowcolor_bool \bottomrule
478 516
	\endlastfoot
479 517
	\ignorespaces
480 518
}{
......
488 526
% analog ist dies für pos, amount, price, pricetotal möglich.
489 527
% Die Spalte der Bezeichnung ist nicht deaktivierbar
490 528
\newenvironment{PricingTabular*}[1][]{
529
	\int_gzero:N \g__kivi_PricingTable_rowcolor_int
491 530
	\tl_if_empty:nF {#1} {\keys_set:nn {kivi/PricingTable} {#1}}
492 531
	\__kivi_setup_LT_boxes:
493 532
	\__kivi_setup_FakeTable:
494 533
	\dim_set:Nn \parskip {\c_zero_dim}
495 534
	\PricingTabularBox\ignorespaces
496
}{\endPricingTabularBox}
535
}{\endPricingTabularBox
536
	%compensate footer spacing
537
	\skip_vertical:n {-\box_ht:N  \g_kivi_LT@foot_box-\box_dp:N  \g_kivi_LT@foot_box}
538
}
497 539

  
498 540
\newtcolorbox{PricingTabularBox}{breakable,skin=kivi@LT}
499 541

  
......
531 573
		\par
532 574
	}
533 575

  
576
\newkomafont{transaction}{\bfseries}
534 577

  
535 578
\setkomavar{location}{
536
	\Ifkomavarempty{transaction}{}{
537
	\bfseries
579
	\Ifkomavarempty{transaction}{}{{
580
	\usekomafont{transaction}
538 581
	\usekomavar{transaction}
539 582
	}
583
	}
540 584
	\par
541 585
	\medskip
542 586
	\parbox{\useplength{locwidth}}{

Auch abrufbar als: Unified diff