------------------layout side
@using payrol.Models.tablolar
@model IEnumerable<member>
@{
ViewBag.Title = "Index";
Layout = "~/Views/shared/Anamasterform.cshtml";
}
<table class="table table-bordered">
<tr>
<th>ID </th>
<th>NAMESURNAME</th>
<th>DAY</th>
<th>WAGE </th>
<th> PICTURE</th>
<th>LEGALDEDUCTION1</th>
<th>LEGALDEDUCTION2</th>
<th>LEGALDEDUCTION3</th>
<th>SPECIALDEDUCTION1</th>
<th>SPECIALDEDUCT1</th>
<th>LEGALDEDUCTION2</th>
<th>LEGALDEDUCTION2</th>
<th>GROSSSALARY</th>
<th>NETSALARY</th>
<th>TOTALOFSPECIALDUTIES</th>
<th>TOTALLEGALDUTIES</th>
<th>EXTRAWORKINGHOURS</th>
<th>EXTRAWORKINGDAYS</th>
<th> taxbase </th>
</tr>
<tbody>
@foreach (var c in Model)
{
<tr>
<td>@c.id </td>
<td>@c.nsname</td>
<td>@c.pictureway</td>
<TD> @ViewBag.GROSSSALARY </TD>
<TD> @ViewBag.ETSALARY </TD>
<th> @ViewBag.TOTALOFSPECIALDUTIES</th>
<th>@ViewBag.TOTVALLEGALDUTIES</th>
<th>@ViewBag.EXTRAWORKINGHOURS</th>
<th>@ViewBag.EXTRAWORKINGDAYS</th>
<th> @ViewBag.taxbase </th>
@*GENARAL REPORT SIDE for taking into account in accounting total total money to be paid from cash*@
<TD> @ViewBag.bigestgrosssalary </TD>
<TD> @ViewBag.bigestspecialduties </TD>
<TD> @ViewBag.bigesttotallegalduties </TD>
<TD> @ViewBag.bigestextraworkinghours </TD>
<TD> @ViewBag.bigestextraworkingdays </TD>
<TD> @ViewBag.bigestnetsalary </TD>
</tr>
}
</tbody>
</table>
----------------------------------------
tables a
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated from a template.
//
// Manual changes to this file may cause unexpected behavior in your application.
// Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace payrol.Models.tablolar
{
using System;
using System.Collections.Generic;
public partial class member
{
public short id { get; set; }
public string nsname { get; set; }
public string pictureway { get; set; }
public Nullable<int> day { get; set; }
public Nullable<decimal> wage { get; set; }
public Nullable<decimal> specialdetuction1 { get; set; }
public Nullable<decimal> specialdetuction12 { get; set; }
public Nullable<decimal> legaldeduction1 { get; set; }
public Nullable<decimal> legaldeduction2 { get; set; }
public Nullable<decimal> legaldeduction3 { get; set; }
public Nullable<decimal> legaldeduction4 { get; set; }
public Nullable<int> EXTRAWORKINGHOURS { get; set; }
public Nullable<int> EXTRTAWORKINGDAYS { get; set; }
public virtual taxandinsurancetable taxandinsurancetable { get; set; }
}
}
--------------------------------
tables b
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated from a template.
//
// Manual changes to this file may cause unexpected behavior in your application.
// Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace payrol.Models.tablolar
{
using System;
using System.Collections.Generic;
public partial class taxandinsurancetable
{
public short id { get; set; }
public decimal basetax { get; set; }
public Nullable<short> memberid { get; set; }
public virtual member member { get; set; }
}
}
-------------------------------------
CONTROLER
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using payrol.Models.tablolar;
namespace payrol.Controllers
{
public class payrolController : Controller
{
bgl db = new bgl();
// GET: payrol
public ActionResult Index()
{
foreach (var model1 in db.member)
{
decimal grosssalary = model1.day.Value * model1.wage.Value;
ViewBag.GROSSSALARY = grosssalary;
decimal totalspecialduties = model1.specialdetuction1.Value + model1.specialdetuction2.Value;
ViewBag.totalspecialduties = totalspecialduties;
Decimal totallegalduties = model1.legaldeduction1.Value + model1.legaldeduction2.Value + model1.legaldeduction3.Value + model1.legaldeduction4.Value;
ViewBag.totallegalduties= totallegalduties;
decimal extraworkinghours = ((model1.wage.Value / model1.extraworkinghours.Value));
ViewBag.extraworkinghours= extraworkinghours;
decimal extraworkingdays = model1.wage.Value * model1.extraworkingdays.Value;
ViewBag.extrtaworkingdays= extraworkingdays;
decimal taxbase = (grosssalary * model1.taxandinsurancetable.basetax) + model1.taxandinsurancetable.basetax;
db.Entry(model1.taxandinsurancetable).State = System.Data.Entity.EntityState.Modified;
//db.SaveChanges(model1.taxandinsurancetable);
ViewBag.taxbase = taxbase;
decimal netsalary = (((grosssalary) - totallegalduties) - (model1.taxandinsurancetable.basetax));
ViewBag.NETSALARY = netsalary;
decimal bigestgrosssalary = +grosssalary;
decimal bigestspecialduties = +totalspecialduties;
decimal bigesttotallegalduties = +totallegalduties;
decimal bigestextraworkinghours = +extraworkinghours;
decimal bigestextraworkingdays = +extraworkingdays;
decimal bigestnetsalary = netsalary;
@ViewBag.bigestgrosssalary = bigestgrosssalary;
@ViewBag.bigestspecialduties = bigestspecialduties;
@ViewBag.bigesttotallegalduties = bigesttotallegalduties;
@ViewBag.bigestextraworkinghours = bigestextraworkinghours;
@ViewBag.bigestextraworkingdays = bigestextraworkingdays;
@ViewBag.bigestnetsalary = bigestnetsalary;
grosssalary = 0;
totalspecialduties = 0;
totallegalduties = 0;
extraworkinghours = 0;
extraworkingdays = 0;
netsalary = 0;
}
return View();
}
}
}
-------------------------
I don't want to use rdlc, etc., or crystal report yet. I rearranged the code. All the fields in the member table are full. Although it has the feature that can be left empty, it says that the object operation object property could not be adapted. Also, the db saving changes are not working. For some reason, I will take a note of the bigest teacher. I could not run the control part. However, it was going well, sir, how did I change the control part? It is necessary to stitch, I also checked one by one, the variables always get values with breakpoint, I couldn't find an empty variable, I couldn't find the error.