Advertisement
Guest User

Xgamerz

a guest
Jul 10th, 2015
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ASP 9.02 KB | None | 0 0
  1. @using Silog.AGIWEB.Areas.Gescom.Models.Achat
  2. @using Silog.AGIWEB.Areas.Gescom.Models.Shared
  3.  
  4.  
  5. @{
  6.     //http://demos.telerik.com/kendo-ui/styling/index# txtbox with button search
  7.  
  8.     TypeDocument typeDocument = TypeDocument.AppelOffre;
  9.     if (ViewData["_typeDocument"] != null)
  10.     {
  11.         typeDocument = (TypeDocument)ViewData["_typeDocument"];
  12.     }
  13.  
  14.     int? numero = null;
  15.     if (ViewData["_numero"] != null)
  16.     {
  17.         numero = (int?)ViewData["_numero"];
  18.     }
  19.  
  20.     bool _visible = false;
  21.     if (ViewData["_visible"] != null)
  22.     {
  23.         _visible = (bool)ViewData["_visible"];
  24.     }
  25.  
  26.     string windowName = "report-window";
  27.     if (numero == null)
  28.     {
  29.         windowName += "-Achat" + typeDocument.ToString();
  30.     }
  31. }
  32.  
  33. <div>
  34.     <script>
  35.         function onActivatePrintWindow() {
  36.             kendo.resize($("#splitterPrint"));
  37.         }
  38.  
  39.         function onCommitReport_Click(e) {
  40.             $("#report-content").empty();
  41.             var std = ($("#tabsReport").select().index() == 0) ? true : false;
  42.             var file = (std) ? $('#listStandard option:selected').val() : $('#listUser option:selected').val();
  43.             var url = '@Url.Action("Report", "Vente", new { type = "_type_", standard="_std_", item="_file_", numero = numero })'.replace("_type_", "@typeDocument").replace("_std_", std).replace("_file_", file);
  44.             var iframe = $('<iframe src="' + url + '" frameborder="0" style="overflow:hidden;height:100%;width:100%" height="100%" width="100%">');
  45.             iframe.appendTo('#report-content');
  46.         }
  47.  
  48.         function onCancelReport_Click(e) {
  49.             $("#@windowName").data("kendoWindow").close();
  50.         }
  51.  
  52.         function onCloseReport() {
  53.             //$("#report-window-content").empty();
  54.         }
  55.     </script>
  56.  
  57.     @(Html.Kendo().Window()
  58.         .Name(windowName)
  59.             //.HtmlAttributes( new { id = "window-" + _line.ToString() } )
  60.         .Title("Print")
  61.         .Content(@<text>@RenderPrintSplitter(typeDocument, numero)</text>)
  62.         .Visible(_visible)
  63.         .Width(1366)
  64.             //.Actions(actions => actions.Pin().Minimize().Maximize().Close())
  65.             //.Events(ev => ev.Close("onCloseReport"))
  66.         .Events(ev => ev.Activate("onActivatePrintWindow"))
  67.         .Modal(true)
  68.     )
  69. </div>
  70.  
  71. @helper RenderPrintSplitter(TypeDocument typeDocument, int? numero)
  72. {
  73.     @(Html.Kendo().Splitter()
  74.         .Name("SplitterReport")
  75.         .HtmlAttributes(new { style = "height: 800px;" })
  76.         .Orientation(SplitterOrientation.Horizontal)
  77.         .Panes(horizontalPanes =>
  78.         {
  79.             horizontalPanes.Add()
  80.                 .HtmlAttributes(new { id = "left-print-pane" })
  81.                 .Size("450px")
  82.                 //.Scrollable(false)
  83.                 .Collapsible(true)
  84.                 .Collapsed(false)
  85.                 .Content(@<text>@RenderPrintFilter(typeDocument, numero)</text>);
  86.  
  87.             horizontalPanes.Add()
  88.                 .HtmlAttributes(new { id = "right-print-pane" })
  89.             //.Size("800px")
  90.             //.Collapsible(true)
  91.             //.Collapsed(true)
  92.             .Content(@<text><div id="report-content" style="height:99%"></div></text>);
  93.         })
  94.     )
  95. }
  96.  
  97. @helper RenderPrintFilter(TypeDocument typeDocument, int? numero)
  98. {
  99.     List<SelectListItem> listStand = new List<SelectListItem>();
  100.     List<SelectListItem> listUser = new List<SelectListItem>();
  101.     switch (typeDocument)
  102.     {
  103.         case TypeDocument.AppelOffre:
  104.             //listStand.Add(new SelectListItem() { Text = "Appel d'offre Client  V1.1", Value = "Appel d'offre Client  V1.1.rpt" });
  105.             break;
  106.         case TypeDocument.Devis:
  107.             //listStand.Add(new SelectListItem() { Text = "Devis Complet V1.1", Value = "Devis Complet V1.1.rpt" });
  108.             break;
  109.         case TypeDocument.CommandeOuverte:
  110.             break;
  111.         case TypeDocument.Commande:
  112.             //listStand.Add(new SelectListItem() { Text = "Commande V6.2", Value = "Commande V6.2.rpt" });
  113.             break;
  114.         case TypeDocument.BonLivraison:
  115.             //listStand.Add(new SelectListItem() { Text = "Bon Livraison V1.2", Value = "Bon Livraison V1.2.rpt" });
  116.             break;
  117.         case TypeDocument.Facture:
  118.             break;
  119.         case TypeDocument.FactureProforma:
  120.             break;
  121.         default:
  122.             break;
  123.     }
  124.    
  125.    
  126.     <table border="1" style="margin-left:auto; margin-right:auto;">
  127.         <tr>
  128.             <td>
  129.                 <table>
  130.                     @if (numero == null)
  131.                     {
  132.                     <tr>
  133.                         <td>@Html.Label("Date Debut")</td>
  134.                         <td>@Html.Kendo().DatePicker().Name("DateDebut").HtmlAttributes(new { style = "width:200px" }).Value(DateTime.Now)</td>
  135.                     </tr>
  136.                     <tr>
  137.                         <td>@Html.Label("Date Fin")</td>
  138.                         <td>@Html.Kendo().DatePicker().Name("DateFin").HtmlAttributes(new { style = "width:200px" }).Value(DateTime.Now)</td>
  139.                     </tr>
  140.                     <tr>
  141.                         <td>@Html.Label(@Resources.Resource.Fournisseur)</td>
  142.                         <td>@Html.Kendo().TextBox().Name("Fournisseur").HtmlAttributes(new { id = "fournisseur-print", style = "width:200px" })</td>
  143.                     </tr>
  144.                     }
  145.                     <tr>
  146.                         <td>@Html.Label(@Resources.Resource.Document)</td>
  147.                         <td>@Html.Kendo().TextBox().Name("Document").Value((numero.HasValue) ? numero.ToString() : null).HtmlAttributes(new { id = "document-print", style = "width:200px" }).Enable((numero == null))</td>
  148.                     </tr>
  149.                     <tr>
  150.                         <td>@Html.Label("Editer Document")</td>
  151.                         <td>
  152.                             @(Html.Kendo().ComboBox().Name("EditerDocument")
  153.                                 .HtmlAttributes(new { id = "document-edit", style = "width:200px" })
  154.                                 .BindTo(new List<SelectListItem>() { new SelectListItem() { Value = "0", Text = "Non édités" }, new SelectListItem() { Value = "1", Text = "Tous" }, new SelectListItem() { Value = "2", Text = "déjà édités" } })
  155.                                 .SelectedIndex(1)
  156.                             )
  157.                         </td>
  158.                     </tr>
  159.                     <tr>
  160.                         <td>@Html.Label("Nombre de copies")</td>
  161.                         <td>@Html.Kendo().TextBox().Name("NombreCopies").HtmlAttributes(new { style = "width:50px" }).Value("1")</td>
  162.                     </tr>
  163.                     <tr>
  164.                         <td>@Html.Label("Destination")</td>
  165.                         <td>
  166.                             @(Html.Kendo().ComboBox().Name("DestinationImpression")
  167.                                 .HtmlAttributes(new { id = "destination-print", style = "width:200px" })
  168.                                 .BindTo(new List<SelectListItem>() { new SelectListItem() { Value = "0", Text = "Ecran" }, new SelectListItem() { Value = "1", Text = "Imprimante" } })
  169.                                 .SelectedIndex(0)
  170.                             )
  171.                         </td>
  172.                     </tr>
  173.                 </table>
  174.             </td>
  175.         </tr>
  176.         <tr style="height:20px"></tr>
  177.         <tr>
  178.             <td>@RenderPrintTabs(listStand, listUser)</td>
  179.         </tr>
  180.         <tr style="height:20px"></tr>
  181.         <tr>
  182.             <td>
  183.     <div style="text-align:right">
  184.         <span class="inlineinput">
  185.             @(Html.Kendo().Button()
  186.                 .Name("commit-report")
  187.                 .HtmlAttributes(new { type = "button", style = "width:100px;" })
  188.                 .Content("Valider F2")
  189.                 .Events(ev => ev.Click("onCommitReport_Click"))
  190.             )
  191.         </span>
  192.         <span class="inlineinput">
  193.             @(Html.Kendo().Button()
  194.                 .Name("cancel-report")
  195.                 .HtmlAttributes(new { type = "button", style = "width:100px;" })
  196.                 .Content("Annuler Ech")
  197.                 .Events(ev => ev.Click("onCancelReport_Click"))
  198.             )
  199.         </span>
  200.     </div>
  201.             </td>
  202.         </tr>
  203.     </table>
  204. }
  205.  
  206. @helper RenderPrintTabs(List<SelectListItem> stand, List<SelectListItem> user)
  207. {
  208.     <text>
  209.         @(Html.Kendo().TabStrip()
  210.             .Name("tabsReport")
  211.             .HtmlAttributes(new { style = "height:350px;" })
  212.             .Items(tabstrip =>
  213.             {
  214.                 tabstrip.Add().Text("Standards")
  215.                     .Selected(true)
  216.                     .Content(@<text>
  217.                         @Html.ListBox("listStandard", stand, new { style = "width:100%; height:295px;" })
  218.                         </text>);
  219.  
  220.                 tabstrip.Add().Text("Utilisateurs")
  221.                     .Content(@<text>
  222.                         @Html.ListBox("listUser", user, new { style = "width:100%; height:295px;" })
  223.                         </text>);
  224.             })
  225.         )
  226.     </text>
  227. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement